![]() |
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.
|
The WaypointHandler class is used throughout the entire project (mainly by the state machine) to globally store a list of waypoints that the rover will navigate to. More...
#include <WaypointHandler.h>
Public Member Functions | |
WaypointHandler () | |
Construct a new geoops::Waypoint Handler:: geoops::Waypoint Handler obstacle. | |
~WaypointHandler () | |
Destroy the geoops::Waypoint Handler:: geoops::Waypoint Handler obstacle. | |
void | AddWaypoint (const geoops::Waypoint &stWaypoint) |
Append a waypoint to the end of the WaypointHandler's list. | |
void | AddWaypoint (const geoops::GPSCoordinate &stLocation, const geoops::WaypointType &eType, const double dRadius=0.0) |
Append a waypoint to the end of the WaypointHandler's list. | |
void | AddWaypoint (const geoops::UTMCoordinate &stLocation, const geoops::WaypointType &eType, const double dRadius=0.0) |
Append a waypoint to the end of the WaypointHandler's list. | |
void | StorePath (const std::string &szPathName, const std::vector< geoops::Waypoint > &vWaypointPath) |
Store a path in the WaypointHandler. | |
void | StorePath (const std::string &szPathName, const std::vector< geoops::GPSCoordinate > &vLocationPath) |
Store a path in the WaypointHandler. | |
void | StorePath (const std::string &szPathName, const std::vector< geoops::UTMCoordinate > &vLocationPath) |
Store a path in the WaypointHandler. | |
void | AddObstacle (const geoops::Waypoint &stWaypoint) |
Append a new obstacle to the WaypointHandler obstacle list. | |
void | AddObstacle (const geoops::GPSCoordinate &stLocation, const double dRadius=0.0) |
Append a new obstacle to the WaypointHandler obstacle list. | |
void | AddObstacle (const geoops::UTMCoordinate &stLocation, const double dRadius=0.0) |
Append a new obstacle to the WaypointHandler obstacle list. | |
void | DeleteWaypoint (const long unsigned int nIndex) |
Delete the geoops::Waypoint at a given index from the waypoint handler. | |
void | DeleteWaypoint (const geoops::Waypoint &stWaypoint) |
Delete a waypoint from the WaypointHandler given a matching waypoint. Any waypoint in the list that matches the given one will be removed. | |
void | DeleteWaypoint (const geoops::GPSCoordinate &stLocation) |
Delete a waypoint from the WaypointHandler given a matching location. Any waypoint in the list that matches the given location will be removed. | |
void | DeleteWaypoint (const geoops::UTMCoordinate &stLocation) |
Delete a waypoint from the WaypointHandler given a matching location. Any waypoint in the list that matches the given location will be removed. | |
bool | DeletePath (const std::string &szPathName) |
Delete the path vector stored at the given key. | |
void | DeleteObstacle (const long unsigned int nIndex) |
Delete the obstacle at a given index from the waypoint handler obstacle list. | |
void | DeleteObstacle (const geoops::Waypoint &stWaypoint) |
Delete an obstacle from the WaypointHandler given a matching location. Any waypoint in the list that matches the given location will be removed. | |
void | DeleteObstacle (const geoops::GPSCoordinate &stLocation) |
Delete an obstacle from the WaypointHandler given a matching location. Any waypoint in the list that matches the given location will be removed. | |
void | DeleteObstacle (const geoops::UTMCoordinate &stLocation) |
Delete an obstacle from the WaypointHandler given a matching location. Any waypoint in the list that matches the given location will be removed. | |
void | ClearWaypoints () |
Clears/deletes all Waypoints stored in the WaypointHandler. | |
void | ClearPaths () |
Clears/deletes all keys and paths store in the WaypointHandler. | |
void | ClearObstacles () |
Clears/deletes all permanent objects stored in the WaypointHandler. | |
geoops::Waypoint | PopNextWaypoint () |
Removes and returns the next waypoint at the front of the list. | |
const geoops::Waypoint | PeekNextWaypoint () |
Returns an immutable reference to the geoops::Waypoint struct at the front of the list without removing it. | |
const geoops::Waypoint | RetrieveWaypointAtIndex (const long unsigned int nIndex) |
Retrieve an immutable reference to the waypoint at the given index. | |
const std::vector< geoops::Waypoint > | RetrievePath (const std::string &szPathName) |
Retrieve an immutable reference to the path at the given path name/key. | |
const geoops::Waypoint | RetrieveObstacleAtIndex (const long unsigned int nIndex) |
Retrieve an immutable reference to the obstacle at the given index. | |
const std::vector< geoops::Waypoint > | GetAllWaypoints () |
Accessor for the full list of current waypoints stored in the WaypointHandler. | |
const std::vector< geoops::Waypoint > | GetAllObstacles () |
Accessor for the full list of current obstacle stored in the WaypointHandler. | |
int | GetWaypointCount () |
Accessor for the number of elements on the WaypointHandler's waypoint vector. | |
int | GetPathsCount () |
Accessor for the number of paths stored in the WaypointHandler. | |
int | GetObstaclesCount () |
Accessor for the number of elements on the WaypointHandler's obstacle vector. | |
geoops::RoverPose | SmartRetrieveRoverPose (bool bVIOHeading=true, bool bVIOTracking=false) |
Retrieve the rover's current position and heading. Automatically picks between getting the position/heading from the NavBoard, ZEDSDK Fusion module, or ZED positional tracking. In most cases, this will be the method that should be called over getting the data directly from NavBoard. | |
double | SmartRetrieveVelocity () |
Retrieve the rover's current velocity. Currently there is no easy way to get the velocity of the ZEDCam so this method just returns the GPS-based velocity. | |
double | SmartRetrieveAngularVelocity () |
Retrieve the rover's current velocity. Currently there is no easy way to get the velocity of the ZEDCam so this method just returns the GPS-based velocity. | |
Private Attributes | |
std::vector< geoops::Waypoint > | m_vWaypointList |
std::shared_mutex | m_muWaypointsMutex |
std::unordered_map< std::string, std::vector< geoops::Waypoint > > | m_umStoredPaths |
std::shared_mutex | m_muPathMutex |
std::vector< geoops::Waypoint > | m_vPermanentObstacles |
std::shared_mutex | m_muObstaclesMutex |
const std::function< void(const rovecomm::RoveCommPacket< double > &, const sockaddr_in &)> | AddPositionLegCallback |
Callback function that is called whenever RoveComm receives new ADDPOSITIONLEG packet. | |
const std::function< void(const rovecomm::RoveCommPacket< double > &, const sockaddr_in &)> | AddMarkerLegCallback |
Callback function that is called whenever RoveComm receives new ADDMARKERLEG packet. | |
const std::function< void(const rovecomm::RoveCommPacket< double > &, const sockaddr_in &)> | AddObjectLegCallback |
Callback function that is called whenever RoveComm receives new ADDOBJECTLEG packet. | |
const std::function< void(const rovecomm::RoveCommPacket< double > &, const sockaddr_in &)> | AddObstacleCallback |
Callback function that is called whenever RoveComm receives new ADDOBSTACLE packet. | |
const std::function< void(const rovecomm::RoveCommPacket< uint8_t > &, const sockaddr_in &)> | ClearWaypointsCallback |
Callback function that is called whenever RoveComm receives new CLEARWAYPOINTS packet. | |
const std::function< void(const rovecomm::RoveCommPacket< uint8_t > &, const sockaddr_in &)> | ClearObstaclesCallback |
Callback function that is called whenever RoveComm receives new CLEAROBSTACLES packet. | |
The WaypointHandler class is used throughout the entire project (mainly by the state machine) to globally store a list of waypoints that the rover will navigate to.
WaypointHandler::WaypointHandler | ( | ) |
Construct a new geoops::Waypoint Handler:: geoops::Waypoint Handler obstacle.
WaypointHandler::~WaypointHandler | ( | ) |
Destroy the geoops::Waypoint Handler:: geoops::Waypoint Handler obstacle.
void WaypointHandler::AddWaypoint | ( | const geoops::Waypoint & | stWaypoint | ) |
Append a waypoint to the end of the WaypointHandler's list.
stWaypoint | - The WaypointHandler::geoops::Waypoint struct containing information about the waypoint to store in the handler. |
void WaypointHandler::AddWaypoint | ( | const geoops::GPSCoordinate & | stLocation, |
const geoops::WaypointType & | eType, | ||
const double | dRadius = 0.0 |
||
) |
Append a waypoint to the end of the WaypointHandler's list.
stLocation | - The location of the waypoint stored in a geoops namespace GPSCoordinate struct. |
eType | - The leg type of the waypoint signalling if this is a tag, navigation, obstacle, etc. waypoint. |
dRadius | - The circular area around the waypoint that should be counted as reaching the waypoint. Or obstacle radius. |
void WaypointHandler::AddWaypoint | ( | const geoops::UTMCoordinate & | stLocation, |
const geoops::WaypointType & | eType, | ||
const double | dRadius = 0.0 |
||
) |
Append a waypoint to the end of the WaypointHandler's list.
stLocation | - The location of the waypoint stored in a geoops namespace UTMCoordinate struct. |
eType | - The leg type of the waypoint signalling if this is a tag, navigation, obstacle, etc. waypoint. |
dRadius | - The circular area around the waypoint that should be counted as reaching the waypoint. Or obstacle radius. |
void WaypointHandler::StorePath | ( | const std::string & | szPathName, |
const std::vector< geoops::Waypoint > & | vWaypointPath | ||
) |
Store a path in the WaypointHandler.
szPathName | - The key that will be used to store, and later reference, the path in the WaypointHandler. |
vWaypointPath | - A vector containing geoops::Waypoint structs with data about each point on the path. |
void WaypointHandler::StorePath | ( | const std::string & | szPathName, |
const std::vector< geoops::GPSCoordinate > & | vLocationPath | ||
) |
Store a path in the WaypointHandler.
szPathName | - The key that will be used to store, and later reference, the path in the WaypointHandler. |
vWaypointPath | - A vector containing GPSCoordinate structs containing location data about each point in the path. |
void WaypointHandler::StorePath | ( | const std::string & | szPathName, |
const std::vector< geoops::UTMCoordinate > & | vLocationPath | ||
) |
Store a path in the WaypointHandler.
szPathName | - The key that will be used to store, and later reference, the path in the WaypointHandler. |
vWaypointPath | - A vector containing UTMCoordinate structs containing location data about each point in the path. |
void WaypointHandler::AddObstacle | ( | const geoops::Waypoint & | stWaypoint | ) |
Append a new obstacle to the WaypointHandler obstacle list.
stWaypoint | - The WaypointHandler::geoops::Waypoint struct containing information about the obstacle to store in the handler. |
void WaypointHandler::AddObstacle | ( | const geoops::GPSCoordinate & | stLocation, |
const double | dRadius = 0.0 |
||
) |
Append a new obstacle to the WaypointHandler obstacle list.
stLocation | - The location of the waypoint stored in a geoops namespace GPSCoordinate struct. |
dRadius | - The circular area around the obstacle or the obstacle radius. |
void WaypointHandler::AddObstacle | ( | const geoops::UTMCoordinate & | stLocation, |
const double | dRadius = 0.0 |
||
) |
Append a new obstacle to the WaypointHandler obstacle list.
stLocation | - The location of the waypoint stored in a geoops namespace UTMCoordinate struct. |
dRadius | - The circular area around the obstacle or the obstacle radius. |
void WaypointHandler::DeleteWaypoint | ( | const long unsigned int | nIndex | ) |
Delete the geoops::Waypoint at a given index from the waypoint handler.
nIndex | - The index of the element to remove. |
void WaypointHandler::DeleteWaypoint | ( | const geoops::Waypoint & | stWaypoint | ) |
Delete a waypoint from the WaypointHandler given a matching waypoint. Any waypoint in the list that matches the given one will be removed.
stWaypoint | - The equivalent waypoint that should be removed. |
void WaypointHandler::DeleteWaypoint | ( | const geoops::GPSCoordinate & | stLocation | ) |
Delete a waypoint from the WaypointHandler given a matching location. Any waypoint in the list that matches the given location will be removed.
stLocation | - The equivalent location that should be removed. |
void WaypointHandler::DeleteWaypoint | ( | const geoops::UTMCoordinate & | stLocation | ) |
Delete a waypoint from the WaypointHandler given a matching location. Any waypoint in the list that matches the given location will be removed.
stLocation | - The equivalent location that should be removed. |
bool WaypointHandler::DeletePath | ( | const std::string & | szPathName | ) |
Delete the path vector stored at the given key.
szPathName | - The name/key of the path that was previously used to store the path. |
void WaypointHandler::DeleteObstacle | ( | const long unsigned int | nIndex | ) |
Delete the obstacle at a given index from the waypoint handler obstacle list.
nIndex | - The index of the element to remove. |
void WaypointHandler::DeleteObstacle | ( | const geoops::Waypoint & | stWaypoint | ) |
Delete an obstacle from the WaypointHandler given a matching location. Any waypoint in the list that matches the given location will be removed.
stWaypoint | - The equivalent obstacle location that should be removed. |
void WaypointHandler::DeleteObstacle | ( | const geoops::GPSCoordinate & | stLocation | ) |
Delete an obstacle from the WaypointHandler given a matching location. Any waypoint in the list that matches the given location will be removed.
stLocation | - The equivalent obstacle location that should be removed. |
void WaypointHandler::DeleteObstacle | ( | const geoops::UTMCoordinate & | stLocation | ) |
Delete an obstacle from the WaypointHandler given a matching location. Any waypoint in the list that matches the given location will be removed.
stLocation | - The equivalent obstacle location that should be removed. |
void WaypointHandler::ClearWaypoints | ( | ) |
Clears/deletes all Waypoints stored in the WaypointHandler.
void WaypointHandler::ClearPaths | ( | ) |
Clears/deletes all keys and paths store in the WaypointHandler.
void WaypointHandler::ClearObstacles | ( | ) |
Clears/deletes all permanent objects stored in the WaypointHandler.
geoops::Waypoint WaypointHandler::PopNextWaypoint | ( | ) |
Removes and returns the next waypoint at the front of the list.
const geoops::Waypoint WaypointHandler::PeekNextWaypoint | ( | ) |
Returns an immutable reference to the geoops::Waypoint struct at the front of the list without removing it.
const geoops::Waypoint WaypointHandler::RetrieveWaypointAtIndex | ( | const long unsigned int | nIndex | ) |
Retrieve an immutable reference to the waypoint at the given index.
nIndex | - The index of the element to retrieve. |
const std::vector< geoops::Waypoint > WaypointHandler::RetrievePath | ( | const std::string & | szPathName | ) |
Retrieve an immutable reference to the path at the given path name/key.
szPathName | - The name/key of the path that was previously used to store the path. |
const geoops::Waypoint WaypointHandler::RetrieveObstacleAtIndex | ( | const long unsigned int | nIndex | ) |
Retrieve an immutable reference to the obstacle at the given index.
nIndex | - The index of the element to retrieve. |
const std::vector< geoops::Waypoint > WaypointHandler::GetAllWaypoints | ( | ) |
Accessor for the full list of current waypoints stored in the WaypointHandler.
const std::vector< geoops::Waypoint > WaypointHandler::GetAllObstacles | ( | ) |
Accessor for the full list of current obstacle stored in the WaypointHandler.
int WaypointHandler::GetWaypointCount | ( | ) |
Accessor for the number of elements on the WaypointHandler's waypoint vector.
int WaypointHandler::GetPathsCount | ( | ) |
Accessor for the number of paths stored in the WaypointHandler.
int WaypointHandler::GetObstaclesCount | ( | ) |
Accessor for the number of elements on the WaypointHandler's obstacle vector.
geoops::RoverPose WaypointHandler::SmartRetrieveRoverPose | ( | bool | bVIOHeading = true , |
bool | bVIOTracking = false |
||
) |
Retrieve the rover's current position and heading. Automatically picks between getting the position/heading from the NavBoard, ZEDSDK Fusion module, or ZED positional tracking. In most cases, this will be the method that should be called over getting the data directly from NavBoard.
bVIOHeading | - Whether to use ZED Heading Fusion. |
bVIOTracking | - Whether to use ZED Positional Tracking. |
double WaypointHandler::SmartRetrieveVelocity | ( | ) |
Retrieve the rover's current velocity. Currently there is no easy way to get the velocity of the ZEDCam so this method just returns the GPS-based velocity.
double WaypointHandler::SmartRetrieveAngularVelocity | ( | ) |
Retrieve the rover's current velocity. Currently there is no easy way to get the velocity of the ZEDCam so this method just returns the GPS-based velocity.
|
private |
Callback function that is called whenever RoveComm receives new ADDPOSITIONLEG packet.
|
private |
Callback function that is called whenever RoveComm receives new ADDMARKERLEG packet.
|
private |
Callback function that is called whenever RoveComm receives new ADDOBJECTLEG packet.
|
private |
Callback function that is called whenever RoveComm receives new ADDOBSTACLE packet.
|
private |
Callback function that is called whenever RoveComm receives new CLEARWAYPOINTS packet.
|
private |
Callback function that is called whenever RoveComm receives new CLEAROBSTACLES packet.