Description

Base class for chrono tracked vehicle systems.

This class provides the interface between the vehicle system and other systems (terrain, driver, etc.)

#include <ChTrackedVehicle.h>

Inheritance diagram for chrono::vehicle::ChTrackedVehicle:
Collaboration diagram for chrono::vehicle::ChTrackedVehicle:

Public Member Functions

 ChTrackedVehicle (const std::string &name, ChContactMethod contact_method=ChContactMethod::NSC)
 Construct a vehicle system with a default ChSystem. More...
 
 ChTrackedVehicle (const std::string &name, ChSystem *system)
 Construct a vehicle system using the specified ChSystem. More...
 
virtual ~ChTrackedVehicle ()
 Destructor.
 
virtual std::string GetTemplateName () const override
 Get the name of the vehicle system template.
 
virtual double GetVehicleMass () const override
 Get the vehicle total mass. More...
 
virtual ChVector GetVehicleCOMPos () const override
 Get the current global vehicle COM location. More...
 
virtual std::shared_ptr< ChPowertrainGetPowertrain () const override
 Get the powertrain attached to this vehicle.
 
std::shared_ptr< ChTrackAssemblyGetTrackAssembly (VehicleSide side) const
 Get the specified suspension subsystem.
 
std::shared_ptr< ChDrivelineTVGetDriveline () const
 Get a handle to the vehicle's driveline subsystem.
 
virtual std::shared_ptr< ChShaftGetDriveshaft () const override
 Get a handle to the vehicle's driveshaft body.
 
virtual double GetDriveshaftSpeed () const override
 Get the angular speed of the driveshaft. More...
 
size_t GetNumRoadWheelAssemblies (VehicleSide side) const
 Get the number of suspensions in the specified track assembly.
 
size_t GetNumTrackShoes (VehicleSide side) const
 Get the number of shoes in the specified track assembly.
 
std::shared_ptr< ChTrackShoeGetTrackShoe (VehicleSide side, size_t id) const
 Get a handle to the specified track shoe.
 
BodyState GetTrackShoeState (VehicleSide side, size_t shoe_id) const
 Get the complete state for the specified track shoe. More...
 
void GetTrackShoeStates (VehicleSide side, BodyStates &states) const
 Get the complete states for all track shoes of the specified track assembly. More...
 
void SetSprocketVisualizationType (VisualizationType vis)
 Set visualization type for the sprocket subsystem.
 
void SetIdlerVisualizationType (VisualizationType vis)
 Set visualization type for the idler subsystem.
 
void SetRoadWheelAssemblyVisualizationType (VisualizationType vis)
 Set visualization type for the suspension subsystems.
 
void SetRoadWheelVisualizationType (VisualizationType vis)
 Set visualization type for the road-wheel subsystems.
 
void SetRollerVisualizationType (VisualizationType vis)
 Set visualization type for the roller subsystems.
 
void SetTrackShoeVisualizationType (VisualizationType vis)
 Set visualization type for the track shoe subsystems.
 
void SetSprocketCollide (bool state)
 Enable/disable collision for the sprocket subsystem.
 
void SetIdlerCollide (bool state)
 Enable/disable collision for the idler subsystem.
 
void SetRoadWheelCollide (bool state)
 Enable/disable collision for the road-wheel subsystems.
 
void SetRollerCollide (bool state)
 Enable/disable collision for the roller subsystems.
 
void SetTrackShoeCollide (bool state)
 Enable/disable collision for the track shoe subsystems.
 
void SetCollide (int flags)
 Set collision flags for the various subsystems. More...
 
virtual void SetChassisVehicleCollide (bool state) override
 Enable/disable collision between the chassis and all other vehicle subsystems. More...
 
void EnableCustomContact (std::shared_ptr< ChTrackCustomContact > callback, bool idler_shoe=true, bool wheel_shoe=true)
 Enable user-defined contact forces between idlers and track shoes and between road wheels and track shoes. More...
 
void MonitorContacts (int flags)
 Set contacts to be monitored. More...
 
void SetContactCollection (bool val)
 Turn on/off contact data collection. More...
 
bool IsPartInContact (TrackedCollisionFlag::Enum part) const
 Return true if the specified vehicle part is currently experiencing a collision.
 
ChVector GetSprocketResistiveTorque (VehicleSide side) const
 Return estimated resistive torque on the specified sprocket. More...
 
void WriteContacts (const std::string &filename)
 Write contact information to file. More...
 
void SetTrackAssemblyOutput (VehicleSide side, bool state)
 Enable/disable output for the track assemblies. More...
 
virtual void Initialize (const ChCoordsys<> &chassisPos, double chassisFwdVel=0) override
 Initialize this vehicle at the specified global location and orientation. More...
 
void InitializePowertrain (std::shared_ptr< ChPowertrain > powertrain)
 Initialize the given powertrain system and associate it to this vehicle. More...
 
void Synchronize (double time, const ChDriver::Inputs &driver_inputs, const TerrainForces &shoe_forces_left, const TerrainForces &shoe_forces_right)
 Update the state of this vehicle at the current time. More...
 
virtual void Advance (double step) override final
 Advance the state of this vehicle by the specified time step. More...
 
virtual void LogConstraintViolations () override
 Log current constraint violations.
 
virtual std::string ExportComponentList () const override
 Return a JSON string with information on all modeling components in the vehicle system. More...
 
virtual void ExportComponentList (const std::string &filename) const override
 Write a JSON-format file with information on all modeling components in the vehicle system. More...
 
- Public Member Functions inherited from chrono::vehicle::ChVehicle
virtual ~ChVehicle ()
 Destructor.
 
const std::string & GetName () const
 Get the name identifier for this vehicle.
 
void SetName (const std::string &name)
 Set the name identifier for this vehicle.
 
ChSystemGetSystem ()
 Get a pointer to the Chrono ChSystem.
 
double GetChTime () const
 Get the current simulation time of the underlying ChSystem.
 
std::shared_ptr< ChChassisGetChassis () const
 Get a handle to the vehicle's main chassis subsystem.
 
std::shared_ptr< ChChassisRearGetChassisRear (int id) const
 Get the specified specified rear chassis subsystem.
 
std::shared_ptr< ChChassisConnectorGetChassisConnector (int id) const
 Get a handle to the specified chassis connector.
 
std::shared_ptr< ChBodyAuxRefGetChassisBody () const
 Get a handle to the vehicle's chassis body.
 
std::shared_ptr< ChBodyAuxRefGetChassisRearBody (int id) const
 Get a handle to the specified rear chassis body.
 
const ChVectorGetVehiclePos () const
 Get the vehicle location. More...
 
ChQuaternion GetVehicleRot () const
 Get the vehicle orientation. More...
 
double GetVehicleSpeed () const
 Get the vehicle speed. More...
 
double GetVehicleSpeedCOM () const
 Get the speed of the chassis COM. More...
 
ChVector GetVehiclePointLocation (const ChVector<> &locpos) const
 Get the global position of the specified point. More...
 
ChVector GetVehiclePointVelocity (const ChVector<> &locpos) const
 Get the global velocity of the specified point. More...
 
ChVector GetVehiclePointAcceleration (const ChVector<> &locpos) const
 Get the acceleration at the specified point. More...
 
ChVector GetDriverPos () const
 Get the global location of the driver.
 
void SetOutput (ChVehicleOutput::Type type, const std::string &out_dir, const std::string &out_name, double output_step)
 Enable output for this vehicle system. More...
 
void SetChassisVisualizationType (VisualizationType vis)
 Set visualization mode for the chassis subsystem.
 
void SetChassisRearVisualizationType (VisualizationType vis)
 Set visualization mode for the rear chassis subsystems.
 
void SetChassisCollide (bool state)
 Enable/disable collision for the chassis subsystem. More...
 
void SetChassisOutput (bool state)
 Enable/disable output from the chassis subsystem.
 

Protected Member Functions

virtual void Output (int frame, ChVehicleOutput &database) const override
 Output data for all modeling components in the vehicle system.
 
- Protected Member Functions inherited from chrono::vehicle::ChVehicle
 ChVehicle (const std::string &name, ChContactMethod contact_method=ChContactMethod::NSC)
 Construct a vehicle system with an underlying ChSystem. More...
 
 ChVehicle (const std::string &name, ChSystem *system)
 Construct a vehicle system using the specified ChSystem. More...
 

Protected Attributes

std::shared_ptr< ChTrackAssemblym_tracks [2]
 track assemblies (left/right)
 
std::shared_ptr< ChDrivelineTVm_driveline
 driveline subsystem
 
std::shared_ptr< ChPowertrainm_powertrain
 associated powertrain system
 
std::shared_ptr< ChTrackCollisionManager > m_collision_manager
 manager for internal collisions
 
std::shared_ptr< ChTrackContactManagerm_contact_manager
 manager for internal contacts
 
- Protected Attributes inherited from chrono::vehicle::ChVehicle
std::string m_name
 vehicle name
 
ChSystemm_system
 pointer to the Chrono system
 
bool m_ownsSystem
 true if system created at construction
 
bool m_output
 generate ouput for this vehicle system
 
ChVehicleOutputm_output_db
 vehicle output database
 
double m_output_step
 output time step
 
double m_next_output_time
 time for next output
 
int m_output_frame
 current output frame
 
std::shared_ptr< ChChassism_chassis
 handle to the main chassis subsystem
 
ChChassisRearList m_chassis_rear
 list of rear chassis subsystems (can be empty)
 
ChChassisConnectorList m_chassis_connectors
 list of chassis connector (must match m_chassis_rear)
 

Friends

class ChTrackedVehicleIrrApp
 

Additional Inherited Members

- Static Protected Member Functions inherited from chrono::vehicle::ChVehicle
template<typename T >
static bool AnyOutput (const std::vector< std::shared_ptr< T >> &list)
 Utility function for testing if any subsystem in a list generates output.
 

Constructor & Destructor Documentation

◆ ChTrackedVehicle() [1/2]

chrono::vehicle::ChTrackedVehicle::ChTrackedVehicle ( const std::string &  name,
ChContactMethod  contact_method = ChContactMethod::NSC 
)

Construct a vehicle system with a default ChSystem.

Parameters
[in]namevehicle name
[in]contact_methodcontact method

◆ ChTrackedVehicle() [2/2]

chrono::vehicle::ChTrackedVehicle::ChTrackedVehicle ( const std::string &  name,
ChSystem system 
)

Construct a vehicle system using the specified ChSystem.

Parameters
[in]namevehicle name
[in]systemcontaining mechanical system

Member Function Documentation

◆ Advance()

void chrono::vehicle::ChTrackedVehicle::Advance ( double  step)
finaloverridevirtual

Advance the state of this vehicle by the specified time step.

In addition to advancing the state of the multibody system (if the vehicle owns the underlying system), this function also advances the state of the associated powertrain.

Reimplemented from chrono::vehicle::ChVehicle.

◆ EnableCustomContact()

void chrono::vehicle::ChTrackedVehicle::EnableCustomContact ( std::shared_ptr< ChTrackCustomContact callback,
bool  idler_shoe = true,
bool  wheel_shoe = true 
)

Enable user-defined contact forces between idlers and track shoes and between road wheels and track shoes.

By default, contact forces between wheels and track shoes are generated by the underlying Chrono contact processing. If enabled, no contact forces are applied automatically. Instead, collisions between wheels (idlers and/or road-wheels) and track shoes are cached and passed to the user-supplied callback which must compute the contact force for each individual collision.

Parameters
callbackuser-supplied callback interface
idler_shoeintercept collisions between idlers and track shoes?
wheel_shoeintercept collisions between road-wheels and track shoes?

◆ ExportComponentList() [1/2]

std::string chrono::vehicle::ChTrackedVehicle::ExportComponentList ( ) const
overridevirtual

Return a JSON string with information on all modeling components in the vehicle system.

These include bodies, shafts, joints, spring-damper elements, markers, etc.

Implements chrono::vehicle::ChVehicle.

◆ ExportComponentList() [2/2]

void chrono::vehicle::ChTrackedVehicle::ExportComponentList ( const std::string &  filename) const
overridevirtual

Write a JSON-format file with information on all modeling components in the vehicle system.

These include bodies, shafts, joints, spring-damper elements, markers, etc.

Implements chrono::vehicle::ChVehicle.

◆ GetDriveshaftSpeed()

virtual double chrono::vehicle::ChTrackedVehicle::GetDriveshaftSpeed ( ) const
inlineoverridevirtual

Get the angular speed of the driveshaft.

This function provides the interface between a vehicle system and a powertrain system.

Implements chrono::vehicle::ChVehicle.

◆ GetSprocketResistiveTorque()

ChVector chrono::vehicle::ChTrackedVehicle::GetSprocketResistiveTorque ( VehicleSide  side) const
inline

Return estimated resistive torque on the specified sprocket.

This torque is available only if monitoring of contacts for that sprocket is enabled.

◆ GetTrackShoeState()

BodyState chrono::vehicle::ChTrackedVehicle::GetTrackShoeState ( VehicleSide  side,
size_t  shoe_id 
) const
inline

Get the complete state for the specified track shoe.

This includes the location, orientation, linear and angular velocities, all expressed in the global reference frame.

◆ GetTrackShoeStates()

void chrono::vehicle::ChTrackedVehicle::GetTrackShoeStates ( VehicleSide  side,
BodyStates states 
) const
inline

Get the complete states for all track shoes of the specified track assembly.

It is assumed that the vector of body states was properly sized.

◆ GetVehicleCOMPos()

ChVector chrono::vehicle::ChTrackedVehicle::GetVehicleCOMPos ( ) const
overridevirtual

Get the current global vehicle COM location.

(Currently not implemented)

Implements chrono::vehicle::ChVehicle.

◆ GetVehicleMass()

double chrono::vehicle::ChTrackedVehicle::GetVehicleMass ( ) const
overridevirtual

Get the vehicle total mass.

This includes the mass of the chassis and all vehicle subsystems.

Implements chrono::vehicle::ChVehicle.

◆ Initialize()

void chrono::vehicle::ChTrackedVehicle::Initialize ( const ChCoordsys<> &  chassisPos,
double  chassisFwdVel = 0 
)
overridevirtual

Initialize this vehicle at the specified global location and orientation.

This base class implementation only initializes the main chassis subsystem. Derived classes must extend this function to initialize all other tracked vehicle subsystems (the two track assemblies and the driveline).

Parameters
[in]chassisPosinitial global position and orientation
[in]chassisFwdVelinitial chassis forward velocity

Implements chrono::vehicle::ChVehicle.

Reimplemented in chrono::vehicle::m113::M113_Vehicle, chrono::vehicle::marder::Marder_Vehicle, and chrono::vehicle::TrackedVehicle.

◆ InitializePowertrain()

void chrono::vehicle::ChTrackedVehicle::InitializePowertrain ( std::shared_ptr< ChPowertrain powertrain)

Initialize the given powertrain system and associate it to this vehicle.

The powertrain is initialized by connecting it to this vehicle's chassis and driveline shaft.

◆ MonitorContacts()

void chrono::vehicle::ChTrackedVehicle::MonitorContacts ( int  flags)
inline

Set contacts to be monitored.

Contact information will be tracked for the specified subsystems.

◆ SetChassisVehicleCollide()

void chrono::vehicle::ChTrackedVehicle::SetChassisVehicleCollide ( bool  state)
overridevirtual

Enable/disable collision between the chassis and all other vehicle subsystems.

This only controls collisions between the chassis and the track shoes. All other internal collisions involving the chassis are always ignored.

Reimplemented from chrono::vehicle::ChVehicle.

◆ SetCollide()

void chrono::vehicle::ChTrackedVehicle::SetCollide ( int  flags)

Set collision flags for the various subsystems.

By default, collision is enabled for chassis, sprocket, idler, road wheels, and track shoes. To override these default settings, this function must be called called after the call to Initialize(). The 'flags' argument can be any of the TrackedCollisionFlag enums, or a combination thereof (using bit-wise operators).

◆ SetContactCollection()

void chrono::vehicle::ChTrackedVehicle::SetContactCollection ( bool  val)
inline

Turn on/off contact data collection.

If enabled, contact information will be collected for all monitored subsystems.

◆ SetTrackAssemblyOutput()

void chrono::vehicle::ChTrackedVehicle::SetTrackAssemblyOutput ( VehicleSide  side,
bool  state 
)

Enable/disable output for the track assemblies.

See also ChVehicle::SetOuput.

◆ Synchronize()

void chrono::vehicle::ChTrackedVehicle::Synchronize ( double  time,
const ChDriver::Inputs &  driver_inputs,
const TerrainForces shoe_forces_left,
const TerrainForces shoe_forces_right 
)

Update the state of this vehicle at the current time.

The vehicle system is provided the current driver inputs (throttle between 0 and 1, steering between -1 and +1, braking between 0 and 1) and terrain forces on the track shoes (expressed in the global reference frame).

Parameters
[in]timecurrent time
[in]driver_inputscurrent driver inputs
[in]shoe_forces_leftvector of track shoe forces (left side)
[in]shoe_forces_rightvector of track shoe forces (left side)

◆ WriteContacts()

void chrono::vehicle::ChTrackedVehicle::WriteContacts ( const std::string &  filename)
inline

Write contact information to file.

If data collection was enabled and at least one subsystem is monitored, contact information is written (in CSV format) to the specified file.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_vehicle/tracked_vehicle/ChTrackedVehicle.h
  • /builds/uwsbel/chrono/src/chrono_vehicle/tracked_vehicle/ChTrackedVehicle.cpp