Description

Base class for all steering path-following PID controllers.

The base class implements the basic functionality to control the error between the location of a sentinel point (a point at a look-ahead distance in front of the vehicle) and the current target point.

Data collection from the steering 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, location of the target point, and location of the sentinel point.

#include <ChSteeringController.h>

Inheritance diagram for chrono::vehicle::ChSteeringController:
Collaboration diagram for chrono::vehicle::ChSteeringController:

Public Member Functions

virtual ~ChSteeringController ()
 Destructor.
 
void SetLookAheadDistance (double dist)
 Specify the look-ahead distance. More...
 
const ChVector3dGetSentinelLocation () const
 Return the current location of the sentinel point. More...
 
const ChVector3dGetTargetLocation () const
 Return the current value of the target point. More...
 
std::shared_ptr< ChBezierCurveGetPath () const
 Return a pointer to the Bezier curve.
 
virtual void Reset (const ChFrameMoving<> &ref_frame)
 Reset the PID controller. More...
 
virtual double Advance (const ChFrameMoving<> &ref_frame, double time, double step)=0
 Advance the state of the PID 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

 ChSteeringController (std::shared_ptr< ChBezierCurve > path)
 Construct a steering controller with default parameters.
 
virtual void CalcTargetLocation ()=0
 Calculate the current target point location. More...
 

Protected Attributes

std::shared_ptr< ChBezierCurvem_path
 tracked path (piecewise cubic Bezier curve)
 
double m_dist
 look-ahead distance
 
ChVector3d m_sentinel
 position of sentinel point in global frame
 
ChVector3d m_target
 position of target point in global frame
 
double m_err
 current error (signed distance to target point)
 
double m_errd
 error derivative
 
double m_erri
 integral of error
 
utils::ChWriterCSVm_csv
 ChWriterCSV object for data collection.
 
bool m_collect
 flag indicating whether or not data is being collected
 

Member Function Documentation

◆ CalcTargetLocation()

virtual void chrono::vehicle::ChSteeringController::CalcTargetLocation ( )
protectedpure virtual

Calculate the current target point location.

All derived classes must implement this function to calculate the current location of the target point, expressed in the global frame. The location of the sentinel point at the current time is calculated and available in m_sentinel.

Implemented in chrono::vehicle::ChPathSteeringControllerStanley, chrono::vehicle::ChPathSteeringControllerSR, chrono::vehicle::ChPathSteeringControllerXT, chrono::vehicle::ChPathSteeringController, and chrono::synchrono::ChMultiplePathSteeringController.

◆ GetSentinelLocation()

const ChVector3d& chrono::vehicle::ChSteeringController::GetSentinelLocation ( ) const
inline

Return the current location of the sentinel point.

The return vector is expressed in the global reference frame.

◆ GetTargetLocation()

const ChVector3d& chrono::vehicle::ChSteeringController::GetTargetLocation ( ) const
inline

Return the current value of the target point.

The return vector is expressed in the global reference frame.

◆ Reset()

void chrono::vehicle::ChSteeringController::Reset ( const ChFrameMoving<> &  ref_frame)
virtual

Reset the PID controller.

This function must be called at a configuration where a valid location for the sentinel point can be calculated. The default implementation in the base class simply calculates the new sentinel point location and sets all errors to 0.

Reimplemented in chrono::vehicle::ChPathSteeringControllerStanley, chrono::vehicle::ChPathSteeringControllerSR, chrono::vehicle::ChPathSteeringControllerXT, chrono::vehicle::ChPathSteeringController, and chrono::synchrono::ChMultiplePathSteeringController.

◆ SetLookAheadDistance()

void chrono::vehicle::ChSteeringController::SetLookAheadDistance ( double  dist)
inline

Specify the look-ahead distance.

This defines the location of the "sentinel" point (in front of the vehicle, at the given distance from the chassis reference frame).


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