Description

Base class for a speed controller.

Data collection from a 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 <ChSpeedController.h>

Inheritance diagram for chrono::vehicle::ChSpeedController:
Collaboration diagram for chrono::vehicle::ChSpeedController:

Public Member Functions

virtual ~ChSpeedController ()
 Destructor.
 
double GetCurrentSpeed () const
 Return the current speed.
 
void Reset (const ChFrameMoving<> &ref_frame)
 Reset the speed controller.
 
double Advance (const ChFrameMoving<> &ref_frame, double target_speed, double time, double step)
 Advance the state of the speed controller.
 
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 Member Functions

virtual void OnReset (const ChFrameMoving<> &ref_frame)=0
 Reset the PID controller.
 
virtual double OnAdvance (const ChFrameMoving<> &ref_frame, double target_speed, double time, double step)=0
 Advance the state of the PID controller. More...
 

Protected Attributes

double m_speed
 current vehicle speed
 
double m_err
 current error (signed distance to target point)
 
double m_errd
 error derivative
 
double m_erri
 integral of error
 
ChWriterCSVm_csv
 ChWriterCSV object for data collection.
 
bool m_collect
 flag indicating whether or not data is being collected
 

Member Function Documentation

◆ OnAdvance()

virtual double chrono::vehicle::ChSpeedController::OnAdvance ( const ChFrameMoving<> &  ref_frame,
double  target_speed,
double  time,
double  step 
)
protectedpure virtual

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/ChSpeedController.h
  • /builds/uwsbel/chrono/src/chrono_vehicle/utils/ChSpeedController.cpp