Description
Base class for chrono vehicle systems.
The reference frame for a vehicle follows the ISO standard: Z-axis up, X-axis pointing forward, and Y-axis towards the left of the vehicle.
#include <ChVehicle.h>
Public Member Functions | |
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. | |
virtual std::string | GetTemplateName () const =0 |
Get the name of the vehicle system template. | |
ChSystem * | GetSystem () |
Get a pointer to the Chrono ChSystem. | |
double | GetChTime () const |
Get the current simulation time of the underlying ChSystem. | |
std::shared_ptr< ChChassis > | GetChassis () const |
Get a handle to the vehicle's main chassis subsystem. | |
std::shared_ptr< ChChassisRear > | GetChassisRear (int id) const |
Get the specified specified rear chassis subsystem. | |
std::shared_ptr< ChChassisConnector > | GetChassisConnector (int id) const |
Get a handle to the specified chassis connector. | |
std::shared_ptr< ChBodyAuxRef > | GetChassisBody () const |
Get a handle to the vehicle's chassis body. | |
std::shared_ptr< ChBodyAuxRef > | GetChassisRearBody (int id) const |
Get a handle to the specified rear chassis body. | |
virtual std::shared_ptr< ChPowertrain > | GetPowertrain () const |
Get the powertrain attached to this vehicle. | |
double | GetMass () const |
Get the vehicle total mass. More... | |
const ChFrame & | GetCOMFrame () const |
Get the current vehicle COM frame (relative to and expressed in the vehicle reference frame). More... | |
const ChMatrix33 & | GetInertia () const |
Get the current vehicle inertia (relative to the vehicle COM frame). | |
const ChFrame & | GetTransform () const |
Get the current vehicle transform relative to the global frame. More... | |
const ChVector & | GetPos () const |
Get the vehicle global location. More... | |
ChQuaternion | GetRot () const |
Get the vehicle orientation. More... | |
double | GetSpeed () const |
Get the vehicle speed. More... | |
ChVector | GetPointLocation (const ChVector<> &locpos) const |
Get the global position of the specified point. More... | |
ChVector | GetPointVelocity (const ChVector<> &locpos) const |
Get the global velocity of the specified point. More... | |
ChVector | GetPointAcceleration (const ChVector<> &locpos) const |
Get the acceleration at the specified point. More... | |
virtual std::shared_ptr< ChShaft > | GetDriveshaft () const =0 |
Get a handle to the vehicle's driveshaft body. | |
ChVector | GetDriverPos () const |
Get the global location of the driver. | |
void | EnableRealtime (bool val) |
Enable/disable soft real-time (default: false). More... | |
double | GetRTF () const |
Get current estimated RTF (real time factor). More... | |
void | SetCollisionSystemType (collision::ChCollisionSystemType collsys_type) |
Change the default collision detection system. More... | |
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... | |
virtual void | Initialize (const ChCoordsys<> &chassisPos, double chassisFwdVel=0) |
Initialize this vehicle at the specified global location and orientation. More... | |
virtual void | InitializeInertiaProperties ()=0 |
Calculate total vehicle mass from subsystems. 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... | |
virtual void | SetChassisVehicleCollide (bool state) |
Enable/disable collision between the chassis and all other vehicle subsystems. More... | |
void | SetChassisOutput (bool state) |
Enable/disable output from the chassis subsystem. | |
bool | HasBushings () const |
Return true if the vehicle model contains bushings. | |
virtual void | Advance (double step) |
Advance the state of this vehicle by the specified time step. More... | |
virtual void | LogConstraintViolations ()=0 |
Log current constraint violations. | |
virtual std::string | ExportComponentList () const =0 |
Return a JSON string with information on all modeling components in the vehicle system. More... | |
virtual void | ExportComponentList (const std::string &filename) const =0 |
Write a JSON-format file with information on all modeling components in the vehicle system. More... | |
virtual void | Output (int frame, ChVehicleOutput &database) const =0 |
Output data for all modeling components in the vehicle system. | |
Protected Member Functions | |
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... | |
void | SetSystem (ChSystem *sys) |
Set the associated Chrono system. | |
virtual void | UpdateInertiaProperties ()=0 |
Calculate current vehicle inertia properties from subsystems. More... | |
Static Protected Member Functions | |
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. | |
Protected Attributes | |
std::string | m_name |
vehicle name | |
ChSystem * | m_system |
pointer to the Chrono system | |
bool | m_ownsSystem |
true if system created at construction | |
double | m_mass |
total vehicle mass | |
ChFrame | m_com |
current vehicle COM (relative to the vehicle reference frame) | |
ChMatrix33 | m_inertia |
current total vehicle inertia (Relative to the vehicle COM frame) | |
bool | m_output |
generate ouput for this vehicle system | |
ChVehicleOutput * | m_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< ChChassis > | m_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 | ChVehicleCosimWheeledVehicleNode |
class | ChVehicleCosimTrackedVehicleNode |
Constructor & Destructor Documentation
◆ ChVehicle() [1/2]
|
protected |
Construct a vehicle system with an underlying ChSystem.
- Parameters
-
[in] name vehicle name [in] contact_method contact method
◆ ChVehicle() [2/2]
|
protected |
Construct a vehicle system using the specified ChSystem.
All physical components of the vehicle will be added to that system.
- Parameters
-
[in] name vehicle name [in] system containing mechanical system
Member Function Documentation
◆ Advance()
|
virtual |
Advance the state of this vehicle by the specified time step.
A call to ChSystem::DoStepDynamics is done only if the vehicle owns the underlying Chrono system. Otherwise, the caller is responsible for advancing the sate of the entire system.
Reimplemented in chrono::vehicle::ChWheeledVehicle, chrono::vehicle::ChTrackedVehicle, and chrono::vehicle::ChTrackTestRig.
◆ EnableRealtime()
|
inline |
Enable/disable soft real-time (default: false).
If enabled, a spinning timer is used to maintain simulation time in sync with real time (if simulation is faster).
◆ ExportComponentList() [1/2]
|
pure virtual |
Return a JSON string with information on all modeling components in the vehicle system.
These include bodies, shafts, joints, spring-damper elements, markers, etc.
Implemented in chrono::vehicle::ChWheeledVehicle, and chrono::vehicle::ChTrackedVehicle.
◆ ExportComponentList() [2/2]
|
pure virtual |
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.
Implemented in chrono::vehicle::ChWheeledVehicle, and chrono::vehicle::ChTrackedVehicle.
◆ GetCOMFrame()
|
inline |
Get the current vehicle COM frame (relative to and expressed in the vehicle reference frame).
This is a frame aligned with the vehicle reference frame and origin at the current vehicle COM.
◆ GetMass()
|
inline |
Get the vehicle total mass.
This includes the mass of the chassis and all vehicle subsystems.
◆ GetPointAcceleration()
Get the acceleration at the specified point.
The point is assumed to be given relative to the main chassis reference frame. The returned acceleration is expressed in the chassis reference frame.
◆ GetPointLocation()
Get the global position of the specified point.
The point is assumed to be given relative to the main chassis reference frame. The returned location is expressed in the global reference frame.
◆ GetPointVelocity()
Get the global velocity of the specified point.
The point is assumed to be given relative to the main chassis reference frame. The returned velocity is expressed in the global reference frame.
◆ GetPos()
|
inline |
Get the vehicle global location.
This is the global location of the main chassis reference frame origin.
◆ GetRot()
|
inline |
Get the vehicle orientation.
This is the main chassis orientation, returned as a quaternion representing a rotation with respect to the global reference frame.
◆ GetRTF()
|
inline |
Get current estimated RTF (real time factor).
Note that the "true" RTF is returned, even if soft real-time is enforced.
◆ GetSpeed()
|
inline |
Get the vehicle speed.
Return the speed measured at the origin of the main chassis reference frame.
◆ GetTransform()
|
inline |
Get the current vehicle transform relative to the global frame.
This is the same as the global transform of the main chassis.
◆ Initialize()
|
virtual |
Initialize this vehicle at the specified global location and orientation.
Derived classes must invoke this base class implementation after they initialize all their subsystem.
- Parameters
-
[in] chassisPos initial global position and orientation [in] chassisFwdVel initial chassis forward velocity
Reimplemented in chrono::vehicle::ChTrackedVehicle, chrono::vehicle::uaz::UAZBUS_SAEVehicle, chrono::vehicle::feda::FEDA_Vehicle, chrono::vehicle::rccar::RCCar_Vehicle, chrono::vehicle::fmtv::LMTV_Vehicle, chrono::vehicle::fmtv::MTV_Vehicle, chrono::vehicle::uaz::UAZBUS_Vehicle, chrono::vehicle::sedan::Sedan_Vehicle, chrono::vehicle::citybus::CityBus_Vehicle, chrono::vehicle::hmmwv::HMMWV_VehicleFull, chrono::vehicle::gator::Gator_Vehicle, chrono::vehicle::mrole::mrole_VehicleFull, chrono::vehicle::generic::Generic_Vehicle, chrono::vehicle::marder::Marder_Vehicle, chrono::vehicle::WheeledVehicle, chrono::vehicle::hmmwv::HMMWV_VehicleReduced, chrono::vehicle::kraz::Kraz_tractor, chrono::vehicle::mrole::mrole_VehicleReduced, chrono::vehicle::m113::M113_Vehicle, and chrono::vehicle::TrackedVehicle.
◆ InitializeInertiaProperties()
|
pure virtual |
Calculate total vehicle mass from subsystems.
This function is called at the end of the vehicle initialization, but can also be called explicitly.
Implemented in chrono::vehicle::ChWheeledVehicle, and chrono::vehicle::ChTrackedVehicle.
◆ SetChassisCollide()
void chrono::vehicle::ChVehicle::SetChassisCollide | ( | bool | state | ) |
Enable/disable collision for the chassis subsystem.
This function controls contact of the chassis with all other collision shapes in the simulation.
◆ SetChassisVehicleCollide()
|
inlinevirtual |
Enable/disable collision between the chassis and all other vehicle subsystems.
Note that some of these collisions may be always disabled, as set by the particular derived vehicle class.
Reimplemented in chrono::vehicle::ChWheeledVehicle, and chrono::vehicle::ChTrackedVehicle.
◆ SetCollisionSystemType()
void chrono::vehicle::ChVehicle::SetCollisionSystemType | ( | collision::ChCollisionSystemType | collsys_type | ) |
Change the default collision detection system.
Note that this function should be called before initialization of the vehicle system in order to create consistent collision models.
◆ SetOutput()
void chrono::vehicle::ChVehicle::SetOutput | ( | ChVehicleOutput::Type | type, |
const std::string & | out_dir, | ||
const std::string & | out_name, | ||
double | output_step | ||
) |
Enable output for this vehicle system.
- Parameters
-
[in] type type of output DB [in] out_dir output directory name [in] out_name rootname of output file [in] output_step interval between output times
◆ UpdateInertiaProperties()
|
protectedpure virtual |
Calculate current vehicle inertia properties from subsystems.
This function is called at the end of each vehicle state advance.
Implemented in chrono::vehicle::ChWheeledVehicle, and chrono::vehicle::ChTrackedVehicle.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono_vehicle/ChVehicle.h
- /builds/uwsbel/chrono/src/chrono_vehicle/ChVehicle.cpp