chrono::vehicle::ChAdaptiveSpeedController Class Reference

Description

Data collection from the speed controller can be started (restarted) and suspended (stopped) as many times as desired.

Data collected so far can be written to a file. The tab-separated output ASCII file contains on each line the time, current desired speed, and current actual speed.

#include <ChAdaptiveSpeedController.h>

Public Member Functions

 ChAdaptiveSpeedController ()
 Construct a speed controller with default parameters. More...
 
 ChAdaptiveSpeedController (const std::string &filename)
 Construct a steering controller with parameters read from a JSON file.
 
virtual ~ChAdaptiveSpeedController ()
 Destructor.
 
void SetGains (double Kp, double Ki, double Kd)
 Set the gains for the PID controller.
 
double GetCurrentSpeed () const
 Return the current speed.
 
virtual void Reset (const ChVehicle &vehicle)
 Reset the PID controller.
 
double Advance (const ChVehicle &vehicle, double target_speed, double target_following_time, double target_min_distance, double current_distance, double step)
 Advance the state of the PID controller. More...
 
void StartDataCollection ()
 Start/restart data collection.
 
void StopDataCollection ()
 Suspend/stop data collection.
 
bool IsDataCollectionEnabled () const
 Return true if data is being collected.
 
bool IsDataAvailable () const
 Return true if data is available for output.
 
void WriteOutputFile (const std::string &filename)
 Output data collected so far to the specified file.
 

Protected Attributes

double m_speed
 current vehicle speed
 
double m_Kp
 
double m_Ki
 PID controller gains.
 
double m_Kd
 
double m_err
 current error (signed distance to target point)
 
double m_errd
 error derivative
 
double m_erri
 integral of error
 
utils::CSV_writer * m_csv
 CSV_writer object for data collection.
 
bool m_collect
 flag indicating whether or not data is being collected
 

Constructor & Destructor Documentation

◆ ChAdaptiveSpeedController()

chrono::vehicle::ChAdaptiveSpeedController::ChAdaptiveSpeedController ( )

Construct a speed controller with default parameters.

Default values are all gains set to zero (no controller). The user is responsible for calling SetGains.

Member Function Documentation

◆ Advance()

double chrono::vehicle::ChAdaptiveSpeedController::Advance ( const ChVehicle vehicle,
double  target_speed,
double  target_following_time,
double  target_min_distance,
double  current_distance,
double  step 
)

Advance the state of the PID controller.

This function performs the required integration for the integral component of the PID controller and returns the calculated controller value.


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