Description

Driver.

#include <ChExternalDriver.h>

Inheritance diagram for chrono::vehicle::ChExternalDriver:
Collaboration diagram for chrono::vehicle::ChExternalDriver:

Public Member Functions

 ChExternalDriver (ChVehicle &vehicle, int port)
 
virtual void Synchronize (double time) override
 Update the state of this driver system at the current time.
 
void AddDataGenerator (std::shared_ptr< DataGeneratorFunctor > functor, float updateRate=-1)
 Add a data generator that is used to send data. More...
 
void AddDataParser (std::shared_ptr< DataParserFunctor > functor)
 Add a data parser that is used when receiving data. 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]).
 

Protected Member Functions

bool SendData (double time)
 Exchange data with the client, by sending a vector of floating point values over TCP socket connection (values are double precision, little endian, 4 bytes each) Simulator actual time is also passed as first value.
 
bool ReceiveData ()
 Exchange data with the client, by receiving a vector of floating point values over TCP socket connection (values are double precision, little endian, 4 bytes each) External time is also received as first value.
 
bool WaitConnection (int port)
 Wait for a client to connect to the interface, on a given port, and wait until not connected. More...
 

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
 

Member Function Documentation

◆ AddDataGenerator()

void chrono::vehicle::ChExternalDriver::AddDataGenerator ( std::shared_ptr< DataGeneratorFunctor >  functor,
float  updateRate = -1 
)

Add a data generator that is used to send data.

On each Synchronize, generators are invoked based on their update rate, and data is sent to the client (external control stack).

◆ AddDataParser()

void chrono::vehicle::ChExternalDriver::AddDataParser ( std::shared_ptr< DataParserFunctor >  functor)

Add a data parser that is used when receiving data.

On each Synchronize, parser are invoked based on the messages that are received

◆ WaitConnection()

bool chrono::vehicle::ChExternalDriver::WaitConnection ( int  port)
protected

Wait for a client to connect to the interface, on a given port, and wait until not connected.

port is a free port number, for example 50009.


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