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
AStar.h
Go to the documentation of this file.
1
12#ifndef ASTAR_H
13#define ASTAR_H
14
15#include "../../util/planners/Nodes.hpp"
16
18// Put implicit includes in here.
19#include <sl/Camera.hpp>
20
22
23
32namespace pathplanners
33{
34
41 class AStar
42 {
43 public:
45 // Declare public member variables.
47
49 // Declare public primary methods.
51 AStar();
52 ~AStar();
53 std::vector<geoops::Waypoint> PlanAvoidancePath(const geoops::Waypoint& stStartCoordinate, const geoops::Waypoint& stGoalCoordinate);
54 std::vector<geoops::Waypoint> PlanAvoidancePath(const geoops::UTMCoordinate& stStartCoordinate, const geoops::UTMCoordinate& stGoalCoordinate);
55 std::vector<geoops::Waypoint> PlanAvoidancePath(const geoops::GPSCoordinate& stStartCoordinate, const geoops::GPSCoordinate& stGoalCoordinate);
57
59 // Setters.
61 void UpsertObstacleData(const geoops::Waypoint& stObstacle);
62 void UpsertObstacleData(const geoops::UTMCoordinate& stObstacle);
63 void UpsertObstacleData(const geoops::GPSCoordinate& stObstacle);
64 void UpsertObstacleData(const std::vector<geoops::Waypoint>& vObstacles);
65 void UpsertObstacleData(const std::vector<geoops::UTMCoordinate>& vObstacles);
66 void UpsertObstacleData(const std::vector<geoops::GPSCoordinate>& vObstacles);
67 void ClearObstacleData();
68
70 // Getters.
72 std::vector<geoops::Waypoint> GetPath() const;
73 std::vector<geoops::Waypoint> GetObstacleData() const;
74
75 private:
77 // Declare private member variables.
79 // Start and Goal Nodes
80 nodes::AStarNode m_stStartNode;
81 nodes::AStarNode m_stGoalNode;
82 // Nodes used as the final path for routing
83 std::vector<geoops::Waypoint> m_vPathCoordinates;
84 // Obstacles for AStar to use during routing
85 std::vector<geoops::Waypoint> m_vObstacles;
86 // Time point for measuring total planning time.
87 std::chrono::steady_clock::time_point m_tmStartTime;
88 std::atomic_bool m_bPathGenerationCancelled;
89
91 // Declare private methods.
95 void RoundUTMCoordinate(geoops::UTMCoordinate& stCoordinateToRound);
96 void ConstructPath(const nodes::AStarNode& stFinalNode);
97 std::string UTMCoordinateToString(const geoops::UTMCoordinate& stToTranslate);
98 bool ValidCoordinate(const double dEasting, const double dNorthing);
99 };
100} // namespace pathplanners
101
102#endif
Implements the A* (ASTAR) algorithm with the ability to plan paths around obstacles and provide path ...
Definition AStar.h:42
void UpsertObstacleData(const geoops::Waypoint &stObstacle)
Adds new obstacle data to the class member variable m_vObstacles.
Definition AStar.cpp:346
std::vector< geoops::Waypoint > PlanAvoidancePath(const geoops::Waypoint &stStartCoordinate, const geoops::Waypoint &stGoalCoordinate)
Called in the obstacle avoidance state to plan a path around obstacles.
Definition AStar.cpp:65
geoops::Waypoint FindNearestStartPoint(const geoops::UTMCoordinate &stStartCoordinate)
Helper function to round a UTMCoordinate to align with the grid.
Definition AStar.cpp:626
std::string UTMCoordinateToString(const geoops::UTMCoordinate &stToTranslate)
Helper function used to translate a UTMCoordinate's dEasting and dNorthing values into a string that ...
Definition AStar.cpp:717
geoops::Waypoint FindNearestGoalPoint(const geoops::UTMCoordinate &stGoalCoordinate)
Helper function for the PlanAvoidancePath method. This method takes in a UTMCoordinate reference and ...
Definition AStar.cpp:508
std::vector< geoops::Waypoint > GetObstacleData() const
Getter for the current obstacle data.
Definition AStar.cpp:490
void CancelPathGeneration()
Cancels the path generation process.
Definition AStar.cpp:333
void ConstructPath(const nodes::AStarNode &stFinalNode)
Called when a goal node has been reached. Recursively builds a vector of UTMCoordinates by tracing th...
Definition AStar.cpp:794
bool ValidCoordinate(const double dEasting, const double dNorthing)
Helper function used to determine if a potential UTMCoordinate is valid. Returns False if there is an...
Definition AStar.cpp:737
std::vector< geoops::Waypoint > GetPath() const
Getter for the path calculated by ASTAR.
Definition AStar.cpp:477
void ClearObstacleData()
Helper function to destroy objects from m_vObstacles.
Definition AStar.cpp:464
AStar()
Construct a new AStar::AStar object.
Definition AStar.cpp:38
void RoundUTMCoordinate(geoops::UTMCoordinate &stCoordinateToRound)
Helper function used to round UTMCoordinates to the nearest constants::ASTAR_NODE_SIZE to avoid round...
Definition AStar.cpp:779
~AStar()
Destroy the AStar::AStar object.
Definition AStar.cpp:50
This namespace stores classes, functions, and structs that are used to implement different path plann...
Definition AStar.cpp:30
This struct stores/contains information about a GPS data.
Definition GeospatialOperations.hpp:99
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
This node struct stores point data needed by the A* (ASTAR) algorithm to properly plan a path....
Definition Nodes.hpp:57