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
geoops Namespace Reference

Namespace containing functions related to operations on global position number systems and other datatypes. More...

Classes

struct  GeoMeasurement
 This struct is used to store the distance, arc length, and relative bearing for a calculated geodesic between two points. Storing these values in a struct allows for easy handling and access to said variables. More...
 
struct  GPSCoordinate
 This struct stores/contains information about a GPS data. More...
 
struct  RoverPose
 This struct is used by the WaypointHandler to provide an easy way to store all pose data about the rover. More...
 
struct  UTMCoordinate
 This struct stores/contains information about a UTM coordinate. More...
 
struct  Waypoint
 This struct is used by the WaypointHandler class to store location, size, and type information about a given location of interest of waypoint. More...
 

Enumerations

enum class  WaypointType {
  eNavigationWaypoint , eTagWaypoint , eMalletWaypoint , eWaterBottleWaypoint ,
  eRockPickWaypoint , eObjectWaypoint , eObstacleWaypoint , eUNKNOWN
}
 
enum class  PositionFixType {
  eNoFix , eDeadReckoning , eFix2D , eFix3D ,
  eGNSSDeadReckoningCombined , eTimeOnly , eUNKNOWN
}
 

Functions

UTMCoordinate ConvertGPSToUTM (const GPSCoordinate &stGPSCoord)
 Given a GPS coordinate, convert to UTM and create a new UTMCoordinate object.
 
GPSCoordinate ConvertUTMToGPS (const UTMCoordinate &stUTMCoord)
 Given a UTM coordinate, convert to GPS and create a new GPSCoordinate object.
 
GeoMeasurement CalculateGeoMeasurement (const GPSCoordinate &stCoord1, const GPSCoordinate &stCoord2)
 The shortest path between two points on an ellipsoid at (lat1, lon1) and (lat2, lon2) is called the geodesic. Given those two points create an ellipsoid with earth's characteristics and find the distance between them.
 
GeoMeasurement CalculateGeoMeasurement (const UTMCoordinate &stCoord1, const UTMCoordinate &stCoord2)
 The shortest path between two points on an ellipsoid at (easting1, northing1) and (easting2, northing2) is called the geodesic. Given those two points create an ellipsoid with earth's characteristics and find the distance between them.
 
GeoMeasurement CalculateGeoMeasurement (const geoops::Waypoint &stWaypoint1, const geoops::Waypoint &stWaypoint2)
 The shortest path between two waypoints on an ellipsoid at (lat1, lon1) and (lat2, lon2) is called the geodesic.
 

Detailed Description

Namespace containing functions related to operations on global position number systems and other datatypes.

Author
ClayJay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-09-30

Enumeration Type Documentation

◆ WaypointType

enum class geoops::WaypointType
strong
40 {
41 eNavigationWaypoint,
42 eTagWaypoint,
43 eMalletWaypoint,
44 eWaterBottleWaypoint,
45 eRockPickWaypoint,
46 eObjectWaypoint, // Used to represent either Mallet, WaterBottle, or RockPick waypoint.
47 eObstacleWaypoint,
48 eUNKNOWN
49 };

◆ PositionFixType

enum class geoops::PositionFixType
strong
53 {
54 eNoFix,
55 eDeadReckoning,
56 eFix2D,
57 eFix3D,
58 eGNSSDeadReckoningCombined,
59 eTimeOnly,
60 eUNKNOWN
61 };

Function Documentation

◆ ConvertGPSToUTM()

UTMCoordinate geoops::ConvertGPSToUTM ( const GPSCoordinate stGPSCoord)
inline

Given a GPS coordinate, convert to UTM and create a new UTMCoordinate object.

Parameters
stGPSCoord- The struct containing the GPS coordinate data.
Returns
UTMCoordinate - The UTM coordinate corresponding to the given GPS coordinate.
Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-10-12
334 {
335 // Create instance variables.
336 UTMCoordinate stConvertCoord;
337
338 // Get data out of the GPS coord and repackage it into the UTM struct.
339 stConvertCoord.d2DAccuracy = stGPSCoord.d2DAccuracy;
340 stConvertCoord.d3DAccuracy = stGPSCoord.d3DAccuracy;
341 stConvertCoord.dAltitude = stGPSCoord.dAltitude;
342 stConvertCoord.eCoordinateAccuracyFixType = stGPSCoord.eCoordinateAccuracyFixType;
343 stConvertCoord.bIsDifferential = stGPSCoord.bIsDifferential;
344 stConvertCoord.tmTimestamp = stGPSCoord.tmTimestamp;
345
346 // Catch errors from GeographicLib.
347 try
348 {
349 // Forward solve for the UTM coord.
350 GeographicLib::UTMUPS::Forward(stGPSCoord.dLatitude,
351 stGPSCoord.dLongitude,
352 stConvertCoord.nZone,
353 stConvertCoord.bWithinNorthernHemisphere,
354 stConvertCoord.dEasting,
355 stConvertCoord.dNorthing,
356 stConvertCoord.dMeridianConvergence,
357 stConvertCoord.dScale);
358 }
359 catch (const GeographicLib::GeographicErr::exception& geError)
360 {
361 // Submit logger message.
362 LOG_ERROR(logging::g_qSharedLogger, "Unable to forward solve a GPSCoordinate to UTMCoordinate. GeographicLib error is: {}", geError.what());
363 }
364
365 // Return the converted UTM coordinate.
366 return stConvertCoord;
367 }
This struct stores/contains information about a UTM coordinate.
Definition GeospatialOperations.hpp:211
Here is the caller graph for this function:

◆ ConvertUTMToGPS()

GPSCoordinate geoops::ConvertUTMToGPS ( const UTMCoordinate stUTMCoord)
inline

Given a UTM coordinate, convert to GPS and create a new GPSCoordinate object.

Parameters
stUTMCoord- The struct containing the UTM coordinate data.
Returns
GPSCoordinate - The GPS coordinate corresponding to the given UTM coordinate.
Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-10-12
379 {
380 // Create instance variables.
381 GPSCoordinate stConvertCoord;
382
383 // Get data out of the UTM coord and repackage it into the GPS struct.
384 stConvertCoord.d2DAccuracy = stUTMCoord.d2DAccuracy;
385 stConvertCoord.d3DAccuracy = stUTMCoord.d3DAccuracy;
386 stConvertCoord.dAltitude = stUTMCoord.dAltitude;
387 stConvertCoord.eCoordinateAccuracyFixType = stUTMCoord.eCoordinateAccuracyFixType;
388 stConvertCoord.bIsDifferential = stUTMCoord.bIsDifferential;
389 stConvertCoord.tmTimestamp = stUTMCoord.tmTimestamp;
390
391 // Catch errors from GeographicLib.
392 try
393 {
394 // Reverse solve for the UTM coord.
395 GeographicLib::UTMUPS::Reverse(stUTMCoord.nZone,
396 stUTMCoord.bWithinNorthernHemisphere,
397 std::fabs(stUTMCoord.dEasting),
398 stUTMCoord.dNorthing,
399 stConvertCoord.dLatitude,
400 stConvertCoord.dLongitude,
401 stConvertCoord.dMeridianConvergence,
402 stConvertCoord.dScale);
403 }
404 catch (const GeographicLib::GeographicErr::exception& geError)
405 {
406 // Submit logger message.
407 LOG_ERROR(logging::g_qSharedLogger, "Unable to reverse solve a UTMCoordinate to GPSCoordinate. GeographicLib error is: {}", geError.what());
408 }
409
410 // Return the converted UTM coordinate.
411 return stConvertCoord;
412 }
This struct stores/contains information about a GPS data.
Definition GeospatialOperations.hpp:100
Here is the caller graph for this function:

◆ CalculateGeoMeasurement() [1/3]

GeoMeasurement geoops::CalculateGeoMeasurement ( const GPSCoordinate stCoord1,
const GPSCoordinate stCoord2 
)
inline

The shortest path between two points on an ellipsoid at (lat1, lon1) and (lat2, lon2) is called the geodesic. Given those two points create an ellipsoid with earth's characteristics and find the distance between them.

Parameters
stCoord1- The first GPS coordinate.
stCoord2- The second GPS coordinate.
Returns
GeoMeasurement - Struct containing the distance in meters and arc length degrees, plus the bearing relative to the first point and second point.
See also
https://geographiclib.sourceforge.io/C++/doc/classGeographicLib_1_1Geodesic.html#ae66c9cecfcbbcb1da52cb408e69f65de
Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-10-13
554 {
555 // Create instance variables.
556 GeoMeasurement stMeasurements;
557
558 // Construct a geodesic with earth characteristics. (Radius and flattening)
559 // The WGS84 standard is widely used and aligns with Google Maps.
560 GeographicLib::Geodesic geGeodesic = GeographicLib::Geodesic::WGS84();
561
562 // Solve the inverse geodesic for distance and arc length degrees at the center of the globe, and relative bearings.
563 stMeasurements.dArcLengthDegrees = geGeodesic.Inverse(stCoord1.dLatitude,
564 stCoord1.dLongitude,
565 stCoord2.dLatitude,
566 stCoord2.dLongitude,
567 stMeasurements.dDistanceMeters,
568 stMeasurements.dStartRelativeBearing,
569 stMeasurements.dEndRelativeBearing);
570
571 // NOTE: Regarding azi1 vs azi2, azi1 is the direction measured at point 1 (your navigation aid) to point 2. azi2 is the direction measured at point 2 (your
572 // location) away from point 1. (If you want the direction to point 1, add ±180° to azi2.)
573 // Map the -180, 180 range of the azimuths to 0, 360, with both points zeroed at North.
574 stMeasurements.dStartRelativeBearing = std::fmod((stMeasurements.dStartRelativeBearing + 360), 360);
575 stMeasurements.dEndRelativeBearing = std::fmod((stMeasurements.dEndRelativeBearing + 180), 360);
576 // Ensure the result angle is positive.
577 if (stMeasurements.dStartRelativeBearing < 0)
578 {
579 // Add 360 degrees.
580 stMeasurements.dStartRelativeBearing += 360;
581 }
582 // Ensure the result angle is positive.
583 if (stMeasurements.dEndRelativeBearing < 0)
584 {
585 // Add 360 degrees.
586 stMeasurements.dEndRelativeBearing += 360;
587 }
588
589 // Return result distance.
590 return stMeasurements;
591 }
This struct is used to store the distance, arc length, and relative bearing for a calculated geodesic...
Definition GeospatialOperations.hpp:83
Here is the caller graph for this function:

◆ CalculateGeoMeasurement() [2/3]

GeoMeasurement geoops::CalculateGeoMeasurement ( const UTMCoordinate stCoord1,
const UTMCoordinate stCoord2 
)
inline

The shortest path between two points on an ellipsoid at (easting1, northing1) and (easting2, northing2) is called the geodesic. Given those two points create an ellipsoid with earth's characteristics and find the distance between them.

Parameters
stCoord1- The first UTM coordinate.
stCoord2- The second UTM coordinate.
Returns
GeoMeasurement - Struct containing the distance in meters and arc length degrees, plus the bearing relative to the first point and second point.
See also
https://geographiclib.sourceforge.io/C++/doc/classGeographicLib_1_1Geodesic.html#ae66c9cecfcbbcb1da52cb408e69f65de
Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2024-01-14
607 {
608 // Create instance variables.
609 GeoMeasurement stMeasurements;
610
611 // Construct a geodesic with earth characteristics. (Radius and flattening)
612 // The WGS84 standard is widely used and aligns with Google Maps.
613 GeographicLib::Geodesic geGeodesic = GeographicLib::Geodesic::WGS84();
614
615 // Convert the given UTM coords into GPS coords for temporary use.
616 GPSCoordinate stGPSCoord1 = ConvertUTMToGPS(stCoord1);
617 GPSCoordinate stGPSCoord2 = ConvertUTMToGPS(stCoord2);
618
619 // Solve the inverse geodesic.
620 stMeasurements.dArcLengthDegrees = geGeodesic.Inverse(stGPSCoord1.dLatitude,
621 stGPSCoord1.dLongitude,
622 stGPSCoord2.dLatitude,
623 stGPSCoord2.dLongitude,
624 stMeasurements.dDistanceMeters,
625 stMeasurements.dStartRelativeBearing,
626 stMeasurements.dEndRelativeBearing);
627
628 // NOTE: Regarding azi1 vs azi2, azi1 is the direction measured at point 1 (your navigation aid) to point 2. azi2 is the direction measured at point 2 (your
629 // location) away from point 1. (If you want the direction to point 1, add ±180° to azi2.)
630 // Map the -180, 180 range of the azimuths to 0, 360, with both points zeroed at North.
631 stMeasurements.dStartRelativeBearing = std::fmod((stMeasurements.dStartRelativeBearing + 360), 360);
632 stMeasurements.dEndRelativeBearing = std::fmod((stMeasurements.dEndRelativeBearing + 180), 360);
633 // Ensure the result angle is positive.
634 if (stMeasurements.dStartRelativeBearing < 0)
635 {
636 // Add 360 degrees.
637 stMeasurements.dStartRelativeBearing += 360;
638 }
639 // Ensure the result angle is positive.
640 if (stMeasurements.dEndRelativeBearing < 0)
641 {
642 // Add 360 degrees.
643 stMeasurements.dEndRelativeBearing += 360;
644 }
645
646 // Return result distance.
647 return stMeasurements;
648 }
GPSCoordinate ConvertUTMToGPS(const UTMCoordinate &stUTMCoord)
Given a UTM coordinate, convert to GPS and create a new GPSCoordinate object.
Definition GeospatialOperations.hpp:378
Here is the call graph for this function:

◆ CalculateGeoMeasurement() [3/3]

GeoMeasurement geoops::CalculateGeoMeasurement ( const geoops::Waypoint stWaypoint1,
const geoops::Waypoint stWaypoint2 
)
inline

The shortest path between two waypoints on an ellipsoid at (lat1, lon1) and (lat2, lon2) is called the geodesic.

Parameters
stWaypoint1- The first waypoint.
stWaypoint2- The second waypoint.
Returns
GeoMeasurement - Struct containing the distance in meters and arc length degrees, plus the bearing relative to the first point and second point.
Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2025-05-06
661 {
662 // Create instance variables.
663 GeoMeasurement stMeasurements;
664
665 // Construct a geodesic with earth characteristics. (Radius and flattening)
666 // The WGS84 standard is widely used and aligns with Google Maps.
667 GeographicLib::Geodesic geGeodesic = GeographicLib::Geodesic::WGS84();
668
669 // Solve the inverse geodesic.
670 stMeasurements.dArcLengthDegrees = geGeodesic.Inverse(stWaypoint1.GetGPSCoordinate().dLatitude,
671 stWaypoint1.GetGPSCoordinate().dLongitude,
672 stWaypoint2.GetGPSCoordinate().dLatitude,
673 stWaypoint2.GetGPSCoordinate().dLongitude,
674 stMeasurements.dDistanceMeters,
675 stMeasurements.dStartRelativeBearing,
676 stMeasurements.dEndRelativeBearing);
677
678 // NOTE: Regarding azi1 vs azi2, azi1 is the direction measured at point 1 (your navigation aid) to point 2. azi2 is the direction measured at point 2 (your
679 // location) away from point 1. (If you want the direction to point 1, add ±180° to azi2.)
680 // Map the -180, 180 range of the azimuths to 0, 360, with both points zeroed at North.
681 stMeasurements.dStartRelativeBearing = std::fmod((stMeasurements.dStartRelativeBearing + 360), 360);
682 stMeasurements.dEndRelativeBearing = std::fmod((stMeasurements.dEndRelativeBearing + 180), 360);
683 // Ensure the result angle is positive.
684 if (stMeasurements.dStartRelativeBearing < 0)
685 {
686 // Add 360 degrees.
687 stMeasurements.dStartRelativeBearing += 360;
688 }
689 // Ensure the result angle is positive.
690 if (stMeasurements.dEndRelativeBearing < 0)
691 {
692 // Add 360 degrees.
693 stMeasurements.dEndRelativeBearing += 360;
694 }
695
696 // Return result distance.
697 return stMeasurements;
698 }
const geoops::GPSCoordinate & GetGPSCoordinate() const
Accessor for the geoops::GPSCoordinate member variable.
Definition GeospatialOperations.hpp:497
Here is the call graph for this function: