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 "../kinematics/UnicycleModel.hpp"
16
18#include <utility>
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.
59 PredictiveStanleyController(const double dControlGain = 0.1,
60 const double dAngularVelocityLimit = 90.0,
61 const int nPredictionHorizon = 5,
62 const double dPredictionTimeStep = 0.01);
64 DriveVector Calculate(const geoops::RoverPose& stCurrentPose, const double dMaxSpeed = constants::NAVIGATING_MOTOR_POWER);
65
67 // Setters.
69
70 void SetReferencePath(const std::vector<geoops::Waypoint>& vReferencePath);
71 void SetReferencePath(const std::vector<geoops::UTMCoordinate>& vReferencePath);
72 void SetReferencePath(const std::vector<geoops::GPSCoordinate>& vReferencePath);
73 void SetControlGain(const double dControlGain);
74 void SetAngularVelocityLimit(const double dAngularVelocityLimit);
75
77 // Getters.
79
80 std::vector<geoops::Waypoint> GetReferencePath() const;
81 double GetControlGain() const;
82 double GetAngularVelocityLimit() const;
83 double GetReferencePathTargetIndex() const;
84
85 private:
87 // Declare private class methods.
89
90 std::pair<geoops::Waypoint, int> FindClosestWaypointInPath(const geoops::UTMCoordinate& stCurrentPosition, const int nStartIndex) const;
91
93 // Declare private member variables.
95
96 UnicycleModel m_UnicycleModel;
97 double m_dControlGain;
98 double m_dAngularVelocityLimit;
99 int m_nPredictionHorizon;
100 double m_dPredictionTimeStep;
101 int m_nCurrentReferencePathTargetIndex;
102 std::vector<geoops::Waypoint> m_vReferencePath;
103 };
104} // namespace controllers
105#endif
This class implements the Unicycle Model. This model is used to predict the future state of the rover...
Definition UnicycleModel.hpp:35
This class implements the Predictive Stanley Controller. This controller is used to follow a path usi...
Definition PredictiveStanleyController.h:44
std::pair< geoops::Waypoint, int > FindClosestWaypointInPath(const geoops::UTMCoordinate &stCurrentPosition, const int nStartIndex) const
Given a position, find the point on the reference path that is closest. Returns both the mapped waypo...
Definition PredictiveStanleyController.cpp:396
double GetControlGain() const
Accessor for the control gain of the stanley controller.
Definition PredictiveStanleyController.cpp:340
void SetAngularVelocityLimit(const double dAngularVelocityLimit)
Setter for the angular velocity limit of the stanley controller.
Definition PredictiveStanleyController.cpp:327
void SetReferencePath(const std::vector< geoops::Waypoint > &vReferencePath)
Sets the path that the controller will follow.
Definition PredictiveStanleyController.cpp:250
void SetControlGain(const double dControlGain)
Setter for the control gain of the stanley controller.
Definition PredictiveStanleyController.cpp:314
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:78
double GetAngularVelocityLimit() const
Accessor for the angular velocity limit of the stanley controller.
Definition PredictiveStanleyController.cpp:353
~PredictiveStanleyController()
Destroy the Predictive Stanley Controller:: Predictive Stanley Controller object.
Definition PredictiveStanleyController.cpp:62
double GetReferencePathTargetIndex() const
Accessor for the current target index in the reference path.
Definition PredictiveStanleyController.cpp:379
std::vector< geoops::Waypoint > GetReferencePath() const
Accessor for the reference path that the controller is following.
Definition PredictiveStanleyController.cpp:366
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:708
This struct stores/contains information about a UTM coordinate.
Definition GeospatialOperations.hpp:211