Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
PredictiveStanleyController.h
Go to the documentation of this file.
1
11#ifndef PREDICTIVE_STANLEY_CONTROLLER_H
12#define PREDICTIVE_STANLEY_CONTROLLER_H
13
14#include "../../util/GeospatialOperations.hpp"
15#include "../../util/logging/PathTracer2D.hpp"
16#include "../kinematics/BicycleModel.hpp"
17
19#include <vector>
20
22
23
32namespace controllers
33{
34
44 {
45 public:
47 // Declare public class structs.
50 {
51 public:
52 double dThetaHeading;
53 double dVelocity;
54 };
55
57 // Declare public class methods.
60 PredictiveStanleyController(const double dControlGain,
61 const double dSteeringAngleLimit,
62 const double dWheelbase,
63 const int nPredictionHorizon,
64 const double dPredictionTimeStep);
66 DriveVector Calculate(const geoops::RoverPose& stCurrentPose, const double dMaxSpeed = constants::NAVIGATING_MOTOR_POWER);
67
69 // Setters.
71
72 void SetReferencePath(const std::vector<geoops::Waypoint>& vReferencePath);
73 void SetReferencePath(const std::vector<geoops::UTMCoordinate>& vReferencePath);
74 void SetReferencePath(const std::vector<geoops::GPSCoordinate>& vReferencePath);
75 void SetControlGain(const double dControlGain);
76 void SetSteeringAngleLimit(const double dSteeringAngleLimit);
77 void SetWheelbase(const double dWheelbase);
78
80 // Getters.
82
83 std::vector<geoops::Waypoint> GetReferencePath() const;
84 double GetControlGain() const;
85 double GetSteeringAngleLimit() const;
86 double GetWheelbase() const;
87 double GetReferencePathTargetIndex() const;
88
89 private:
91 // Declare private class methods.
93
94 geoops::Waypoint FindClosestWaypointInPath(const geoops::UTMCoordinate& stCurrentPosition, const double dCurrentHeading);
95
97 // Declare private member variables.
99
100 BicycleModel m_BicycleModel;
101 double m_dControlGain;
102 double m_dSteeringAngleLimit;
103 double m_dWheelbase;
104 int m_nPredictionHorizon;
105 double m_dPredictionTimeStep;
106 int m_nCurrentReferencePathTargetIndex;
107 std::vector<double> m_vReferencePathCurvature;
108 std::vector<geoops::Waypoint> m_vReferencePath;
109 };
110} // namespace controllers
111#endif
This class implements the Bicycle Model. This model is used to predict the future state of the rover ...
Definition BicycleModel.hpp:35
This class implements the Predictive Stanley Controller. This controller is used to follow a path usi...
Definition PredictiveStanleyController.h:44
double GetSteeringAngleLimit() const
Accessor for the steering angle limit of the stanley controller.
Definition PredictiveStanleyController.cpp:387
double GetWheelbase() const
Accessor for the wheelbase of the stanley controller.
Definition PredictiveStanleyController.cpp:400
double GetControlGain() const
Accessor for the control gain of the stanley controller.
Definition PredictiveStanleyController.cpp:374
void SetReferencePath(const std::vector< geoops::Waypoint > &vReferencePath)
Sets the path that the controller will follow.
Definition PredictiveStanleyController.cpp:203
void SetSteeringAngleLimit(const double dSteeringAngleLimit)
Setter for the steering angle limit of the stanley controller.
Definition PredictiveStanleyController.cpp:348
void SetControlGain(const double dControlGain)
Setter for the control gain of the stanley controller.
Definition PredictiveStanleyController.cpp:335
DriveVector Calculate(const geoops::RoverPose &stCurrentPose, const double dMaxSpeed=constants::NAVIGATING_MOTOR_POWER)
Calculate an updated steering angle for the rover based on the current pose using the predictive stan...
Definition PredictiveStanleyController.cpp:100
void SetWheelbase(const double dWheelbase)
Setter for the wheelbase of the stanley controller.
Definition PredictiveStanleyController.cpp:361
~PredictiveStanleyController()
Destroy the Predictive Stanley Controller:: Predictive Stanley Controller object.
Definition PredictiveStanleyController.cpp:84
double GetReferencePathTargetIndex() const
Accessor for the current target index in the reference path.
Definition PredictiveStanleyController.cpp:426
geoops::Waypoint FindClosestWaypointInPath(const geoops::UTMCoordinate &stCurrentPosition, const double dCurrentHeading)
Given the current position of the rover, find the point on the reference path that is closest to the ...
Definition PredictiveStanleyController.cpp:442
PredictiveStanleyController()
Construct a new Predictive Stanley Controller:: Predictive Stanley Controller object.
Definition PredictiveStanleyController.cpp:37
std::vector< geoops::Waypoint > GetReferencePath() const
Accessor for the reference path that the controller is following.
Definition PredictiveStanleyController.cpp:413
This namespace stores classes, functions, and structs that are used to implement different controller...
Definition PIDController.cpp:26
Definition PredictiveStanleyController.h:50
This struct is used by the WaypointHandler to provide an easy way to store all pose data about the ro...
Definition GeospatialOperations.hpp:677
This struct stores/contains information about a UTM coordinate.
Definition GeospatialOperations.hpp:195
This struct is used by the WaypointHandler class to store location, size, and type information about ...
Definition GeospatialOperations.hpp:392