chrono::vehicle::ChSteeringController Class Referenceabstract

## 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.

The parameters of a steering controller can also be specified through a JSON file; sample JSON input file:

     {
"Gains":
{
"Kp":   0.5,
"Ki" : 0.0,
"Kd" : 0.0
},
         "Lookahead Distance": 20.0
}


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.

const ChVectorGetSentinelLocation () const
Return the current location of the sentinel point. More...

const ChVectorGetTargetLocation () 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 ChVehicle &vehicle)
Reset the PID controller. More...

virtual double Advance (const ChVehicle &vehicle, 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

ChVector m_sentinel
position of sentinel point in global frame

ChVector 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::CSV_writer * m_csv
CSV_writer object for data collection.

bool m_collect
flag indicating whether or not data is being collected

## ◆ 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.

## ◆ GetSentinelLocation()

 const ChVector& 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 ChVector& 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 ChVehicle & vehicle )
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.