Description

Driver inputs for a suspension test rig 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  left_post  right_post  steering

It is assumed that the time values are unique. If the time values are not sorted, this must be specified at construction. Inputs for post_left, post_right, and steering are assumed to be in [-1,1]. Driver inputs at intermediate times are obtained through linear interpolation.

#include <ChDataDriverSTR.h>

Inheritance diagram for chrono::vehicle::ChDataDriverSTR:
Collaboration diagram for chrono::vehicle::ChDataDriverSTR:

Classes

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

Public Member Functions

 ChDataDriverSTR (const std::string &filename, bool sorted=true)
 Construct using data from the specified file. More...
 
 ChDataDriverSTR (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::ChDriverSTR
double GetDisplacementLeft () const
 Get the left post vertical displacement (in the range [-1,+1])
 
double GetDisplacementRight () const
 Get the right post vertical displacement (in the range [-1,+1])
 
double GetSteering () const
 Get the driver steering input (in the range [-1,+1])
 
virtual void Initialize ()
 Initialize this driver system.
 
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 SetTimeDelay (double delay)
 Set value of the time delay. More...
 
void SetDisplacementLeft (double val, double min_val=-1, double max_val=1)
 Overwrite the value for the driver left post displacement input.
 
void SetDisplacementRight (double val, double min_val=-1, double max_val=1)
 Overwrite the value for the driver right post displacement input.
 
void SetSteering (double val, double min_val=-1, double max_val=1)
 Overwrite the value for the driver steering input.
 

Additional Inherited Members

- Protected Attributes inherited from chrono::vehicle::ChDriverSTR
double m_displLeft
 current value of left post displacement
 
double m_displRight
 current value of right post displacement
 
double m_steering
 current value of steering input
 
double m_delay
 time delay before generating inputs
 

Constructor & Destructor Documentation

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

Construct using data from the specified file.

Parameters
filenamename of data file
sortedindicate whether entries are sorted by time stamps
chrono::vehicle::ChDataDriverSTR::ChDataDriverSTR ( const std::vector< Entry > &  data,
bool  sorted = true 
)

Construct using data from the specified data entries.

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

Member Function Documentation

void chrono::vehicle::ChDataDriverSTR::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::ChDriverSTR.