chrono::vehicle::ChDataDriver Class Reference

Description

Driver inputs from data file.

A driver model based on user inputs provided as time series. If provided as a text file, each line in the file must contain 4 values: time steering throttle braking clutch It is assumed that the time values are unique. If the time values are not sorted, this must be specified at construction. Driver inputs at intermediate times are obtained through linear interpolation.

#include <ChDataDriver.h>

Inheritance diagram for chrono::vehicle::ChDataDriver:
Collaboration diagram for chrono::vehicle::ChDataDriver:

Classes

struct  Entry
 Definition of driver inputs at a given time. More...
 

Public Member Functions

 ChDataDriver (ChVehicle &vehicle, const std::string &filename, bool sorted=true)
 Construct using data from the specified file. More...
 
 ChDataDriver (ChVehicle &vehicle, const std::vector< Entry > &data, bool sorted=true)
 Construct using data from the specified data entries. More...
 
virtual void Synchronize (double time) override
 Update the driver system at the specified time. More...
 
- Public Member Functions inherited from chrono::vehicle::ChDriver
 ChDriver (ChVehicle &vehicle)
 Construct a driver subsystem associated with the given vehicle.
 
double GetThrottle () const
 Get the driver throttle input (in the range [0,1]).
 
double GetSteering () const
 Get the driver steering input (in the range [-1,+1]).
 
double GetBraking () const
 Get the driver braking input (in the range [0,1]).
 
double GetClutch () const
 Get the driver clutch input (in the range [0,1]).
 
DriverInputs GetInputs () const
 Get all current inputs at once.
 
virtual void Initialize ()
 Initialize this driver system.
 
virtual void Advance (double step)
 Advance the state of this driver system by the specified time step.
 
bool LogInit (const std::string &filename)
 Initialize output file for recording driver inputs.
 
bool Log (double time)
 Record the current driver inputs to the log file.
 
void SetSteering (double steering)
 Overwrite the value for the driver steering input (input is clamped in [-1,+1]).
 
void SetThrottle (double throttle)
 Overwrite the value for the driver throttle input (input is clamped in [0,+1]).
 
void SetBraking (double braking)
 Overwrite the value for the driver braking input (input is clamped in [0,+1]).
 
void SetClutch (double clutch)
 Overwrite the value for the clutch braking input (input is clamped in [0,+1]).
 

Additional Inherited Members

- Protected Attributes inherited from chrono::vehicle::ChDriver
ChVehiclem_vehicle
 reference to associated vehicle
 
double m_throttle
 current value of throttle input
 
double m_steering
 current value of steering input
 
double m_braking
 current value of braking input
 
double m_clutch
 current value of clutch input
 

Constructor & Destructor Documentation

◆ ChDataDriver() [1/2]

chrono::vehicle::ChDataDriver::ChDataDriver ( ChVehicle vehicle,
const std::string &  filename,
bool  sorted = true 
)

Construct using data from the specified file.

Parameters
vehicleassociated vehicle
filenamename of data file
sortedindicate whether entries are sorted by time stamps

◆ ChDataDriver() [2/2]

chrono::vehicle::ChDataDriver::ChDataDriver ( ChVehicle vehicle,
const std::vector< Entry > &  data,
bool  sorted = true 
)

Construct using data from the specified data entries.

Parameters
vehicleassociated vehicle
datavector of data entries
sortedindicate whether entries are sorted by time stamps

Member Function Documentation

◆ Synchronize()

void chrono::vehicle::ChDataDriver::Synchronize ( double  time)
overridevirtual

Update the driver system at the specified time.

The driver inputs are obtained through linear interpolation between the provided data points.

Reimplemented from chrono::vehicle::ChDriver.


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