chrono::vehicle::ChPathSteeringControllerPID Class Reference

Description

Path-following steering PID controller.

The path to be followed is specified as a ChBezierCurve object and the target point is defined to be the point on that path that is closest to the current location of the sentinel 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
     }

#include <ChSteeringController.h>

Inheritance diagram for chrono::vehicle::ChPathSteeringControllerPID:
Collaboration diagram for chrono::vehicle::ChPathSteeringControllerPID:

Public Member Functions

 ChPathSteeringControllerPID (std::shared_ptr< ChBezierCurve > path)
 Construct a steering controller to track the specified path. More...
 
 ChPathSteeringControllerPID (const std::string &filename, std::shared_ptr< ChBezierCurve > path)
 Construct a steering controller to track the specified path. More...
 
void SetGains (double Kp, double Ki, double Kd)
 Set the gains for the PID controller.
 
virtual void CalcTargetLocation () override
 Calculate the current target point location. More...
 
- Public Member Functions inherited from chrono::vehicle::ChSteeringController
virtual ~ChSteeringController ()
 Destructor.
 
void SetRearSteering (bool rear_steering)
 Specify rear-axle steering (default: false).
 
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.
 
void Reset (const ChFrameMoving<> &ref_frame)
 Reset the PID controller. More...
 
double Advance (const ChFrameMoving<> &ref_frame, double time, double step)
 Advance the state of the PID controller and return the steering input.
 
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.
 

Additional Inherited Members

- Protected Member Functions inherited from chrono::vehicle::ChSteeringController
 ChSteeringController (std::shared_ptr< ChBezierCurve > path)
 Construct a steering controller with default parameters.
 
- Protected Attributes inherited from chrono::vehicle::ChSteeringController
std::shared_ptr< ChBezierCurvem_path
 tracked path (piecewise cubic Bezier curve)
 
std::unique_ptr< ChBezierCurveTrackerm_tracker
 path tracker
 
double m_dist
 look-ahead distance
 
bool m_rear_steering
 rear-axle steering?
 
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
 
ChWriterCSVm_csv
 object for data collection
 
bool m_collect
 flag indicating whether or not data is being collected
 

Constructor & Destructor Documentation

◆ ChPathSteeringControllerPID() [1/2]

chrono::vehicle::ChPathSteeringControllerPID::ChPathSteeringControllerPID ( std::shared_ptr< ChBezierCurve path)

Construct a steering controller to track the specified path.

This version uses default controller parameters (zero gains). The user is responsible for calling SetGains and SetLookAheadDistance.

◆ ChPathSteeringControllerPID() [2/2]

chrono::vehicle::ChPathSteeringControllerPID::ChPathSteeringControllerPID ( const std::string &  filename,
std::shared_ptr< ChBezierCurve path 
)

Construct a steering controller to track the specified path.

This version reads controller gains and lookahead distance from the specified JSON file.

Member Function Documentation

◆ CalcTargetLocation()

void chrono::vehicle::ChPathSteeringControllerPID::CalcTargetLocation ( )
overridevirtual

Calculate the current target point location.

The target point is the point on the associated path that is closest to the current location of the sentinel point.

Implements chrono::vehicle::ChSteeringController.


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