![]() |
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.
|
This class implements a geospatial path planner that uses AStar's algorithm with a bias towards travel scores to find the optimal path between two points. geospatial data is fetched from the LidarHandler, and the path is planned using the Eigen library for matrix operations. More...
#include <GeoPlanner.h>

Classes | |
| struct | PlannerState |
| This struct represents the state of a node in the path planning algorithm. More... | |
| struct | PlannerStateCompare |
| This struct is used to compare two PlannerState objects based on their cost. More... | |
| struct | TileKey |
| This struct represents a tile key in the implicit graph representation. We divide the plan into a regular grid of tiles of size dTileSize*dTileSize meters. A tile covering the real-world X coordinate in [i*dTileSize, (i+1)*dTileSize) and Y coordinate in [j*dTileSize, (j+1)*dTileSize) is represented by the key (i, j). More... | |
| struct | TileKeyEqual |
| This struct is used to compare two TileKey objects for equality. After the hashbuckets narrow down candidates, we need to still confirm that the X and Y coordinates are equal to ensure they are the same tile. More... | |
| struct | TileKeyHash |
| This struct is used to hash TileKey objects for use in unordered maps. It combines the X and Y coordinates to create a unique hash for each tile key. We hash stKey.nX and stKey.nY separately and combine them using XOR and bit shifting. More... | |
Public Member Functions | |
| GeoPlanner (double dTileSize=50.0) | |
| Construct a new Geo Planner:: Geo Planner object. | |
| ~GeoPlanner () | |
| Destroy the Geo Planner:: Geo Planner object. | |
| std::vector< geoops::Waypoint > | PlanPath (LiDARHandler *pLiDARHandler, const geoops::UTMCoordinate &stStart, const geoops::UTMCoordinate &stEnd, double dSearchRadius=2.0, double dMaxSearchTimeSeconds=240.0, bool bPlotPath=false) |
| Plan a path from the start to the end UTM coordinates using A* algorithm. | |
| void | ClearGeoCache () |
| Clear all cached tiles and KD-Tree data. | |
| void | SetTileSize (double dTileSize) |
| Set the size of each tile in meters. | |
| void | SetMinTravScore (double dMinTravScore) |
| Set the minimum traversal score for path planning. | |
| void | SetBetaBias (double dBetaBias) |
| Set the beta bias for travel scores in path planning. | |
| double | GetTileSize () const |
| Get the size of each tile in meters. | |
| double | GetMinTravScore () const |
| Get the minimum traversal score for path planning. | |
| double | GetBetaBias () const |
| Get the beta bias for travel scores in path planning. | |
Private Member Functions | |
| bool | InitializeSearch (const geoops::UTMCoordinate &stStart, const geoops::UTMCoordinate &stEnd) |
| Initialize the search by caching the start and end tiles and setting up initial states. | |
| void | SearchAStar () |
| Perform the A* search algorithm to find the optimal path. | |
| std::vector< geoops::Waypoint > | ReconstructPath () const |
| Plan a path from the start to the end UTM coordinates using A* algorithm. | |
| void | CheckAndLoadTile (const PlannerState &stCurrentState) |
| Check if the tile containing the current state is loaded, and if not, load it. | |
| PlannerState | FindClosestLiDARPoint (const geoops::UTMCoordinate &stCoordinate) |
| Find the closest LiDAR point to the given UTM coordinate. | |
| void | PlotPathAndTerrain (const std::vector< geoops::Waypoint > &vPath) const |
| Plot the given path and the terrain points that the path goes through. | |
| double | EuclideanDistance (double dEasting1, double dNorthing1, double dAltitude1, double dEasting2, double dNorthing2, double dAltitude2) const |
| Calculate the distance between two UTM coordinates. | |
Private Attributes | |
| const std::function< void(const rovecomm::RoveCommPacket< float > &, const sockaddr_in &)> | MinTravScore |
| Callback function used to set the minimum travel score for path planning. | |
| const std::function< void(const rovecomm::RoveCommPacket< float > &, const sockaddr_in &)> | BetaBias |
| Callback function used to set the beta bias for travel scores in path planning. | |
| int | m_nStartID |
| int | m_nEndID |
| double | m_dBeta |
| double | m_dMinTravScore |
| double | m_dTileSize |
| double | m_dSearchRadius |
| double | m_dMaxSearchTimeSeconds |
| LiDARHandler * | m_pLiDARHandler |
| std::unique_ptr< logging::graphing::PathTracer > | m_pPathTracer |
| std::unique_ptr< KDTree2D > | m_pKDTree |
| std::mutex | m_muPathGenMutex |
| std::priority_queue< PlannerState, std::vector< PlannerState >, PlannerStateCompare > | m_pqOpenSetNextBest |
| std::unordered_map< int, int > | m_umPredecessors |
| std::unordered_set< int > | m_usClosedSet |
| std::unordered_map< int, PlannerState > | m_umAllStates |
| std::unordered_map< TileKey, std::vector< LiDARHandler::PointRow >, TileKeyHash, TileKeyEqual > | m_umTileMapCache |
| std::unordered_set< TileKey, TileKeyHash, TileKeyEqual > | m_usKDTreeInsertedTiles |
This class implements a geospatial path planner that uses AStar's algorithm with a bias towards travel scores to find the optimal path between two points. geospatial data is fetched from the LidarHandler, and the path is planned using the Eigen library for matrix operations.
| pathplanners::GeoPlanner::GeoPlanner | ( | double | dTileSize = 50.0 | ) |
Construct a new Geo Planner:: Geo Planner object.
| dTileSize | - The size of each tile in meters. Default is 5.0 meters. |
| pathplanners::GeoPlanner::~GeoPlanner | ( | ) |
Destroy the Geo Planner:: Geo Planner object.
| std::vector< geoops::Waypoint > pathplanners::GeoPlanner::PlanPath | ( | LiDARHandler * | pLiDARHandler, |
| const geoops::UTMCoordinate & | stStart, | ||
| const geoops::UTMCoordinate & | stEnd, | ||
| double | dSearchRadius = 2.0, |
||
| double | dMaxSearchTimeSeconds = 240.0, |
||
| bool | bPlotPath = false |
||
| ) |
Plan a path from the start to the end UTM coordinates using A* algorithm.
| pLiDARHandler | - Pointer to the LiDARHandler instance for fetching geospatial data. |
| stStart | - The starting UTM coordinate. |
| stEnd | - The ending UTM coordinate. |
| dBeta | - A bias factor for traversal score weighting. Higher values favor safer paths with better trav_scores. |
| dSearchRadius | - The radius in meters to search for neighboring points during path planning. |
| dMaxSearchTimeSeconds | - The maximum time in seconds to spend searching for a path. |
| bPlotPath | - Whether to plot the planned path and terrain in 3D. |


| void pathplanners::GeoPlanner::ClearGeoCache | ( | ) |
Clear all cached tiles and KD-Tree data.
| void pathplanners::GeoPlanner::SetTileSize | ( | double | dTileSize | ) |
Set the size of each tile in meters.
| dTileSize | - The new tile size in meters. |
| void pathplanners::GeoPlanner::SetMinTravScore | ( | double | dMinTravScore | ) |
Set the minimum traversal score for path planning.
| dMinTravScore | - The new minimum traversal score. |
| void pathplanners::GeoPlanner::SetBetaBias | ( | double | dBetaBias | ) |
Set the beta bias for travel scores in path planning.
| dBetaBias | - The new beta bias value. |
| double pathplanners::GeoPlanner::GetTileSize | ( | ) | const |
Get the size of each tile in meters.
| double pathplanners::GeoPlanner::GetMinTravScore | ( | ) | const |
Get the minimum traversal score for path planning.
| double pathplanners::GeoPlanner::GetBetaBias | ( | ) | const |
Get the beta bias for travel scores in path planning.
|
private |
Initialize the search by caching the start and end tiles and setting up initial states.
| stStart | - The starting UTM coordinate. |
| stEnd | - The ending UTM coordinate. |


|
private |
Perform the A* search algorithm to find the optimal path.


|
private |
Plan a path from the start to the end UTM coordinates using A* algorithm.

|
private |
Check if the tile containing the current state is loaded, and if not, load it.
| stCurrentState | - The current planner state. |


|
private |
Find the closest LiDAR point to the given UTM coordinate.
| stCoordinate | - The UTM coordinate to find the closest LiDAR point to. |


|
private |
Plot the given path and the terrain points that the path goes through.
| vPath | - The vector of waypoints representing the path to plot. |

|
private |
Calculate the distance between two UTM coordinates.
| dEasting1 | - The easting of the first point. |
| dNorthing1 | - The northing of the first point. |
| Altitude1 | - The altitude of the first point. |
| dEasting2 | - The easting of the second point. |
| dNorthing2 | - The northing of the second point. |
| Altitude2 | - The altitude of the second point. |

|
private |
Callback function used to set the minimum travel score for path planning.
|
private |
Callback function used to set the beta bias for travel scores in path planning.