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  IMUData
 This struct stores/contains information about orientation. 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 ,
  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.
 

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 eObjectWaypoint, // Used to represent either Mallet or WaterBottle waypoint.
46 eObstacleWaypoint,
47 eUNKNOWN
48 };

◆ PositionFixType

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

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
352 {
353 // Create instance variables.
354 UTMCoordinate stConvertCoord;
355
356 // Get data out of the GPS coord and repackage it into the UTM struct.
357 stConvertCoord.d2DAccuracy = stGPSCoord.d2DAccuracy;
358 stConvertCoord.d3DAccuracy = stGPSCoord.d3DAccuracy;
359 stConvertCoord.dAltitude = stGPSCoord.dAltitude;
360 stConvertCoord.eCoordinateAccuracyFixType = stGPSCoord.eCoordinateAccuracyFixType;
361 stConvertCoord.bIsDifferential = stGPSCoord.bIsDifferential;
362 stConvertCoord.tmTimestamp = stGPSCoord.tmTimestamp;
363
364 // Catch errors from GeographicLib.
365 try
366 {
367 // Forward solve for the UTM coord.
368 GeographicLib::UTMUPS::Forward(stGPSCoord.dLatitude,
369 stGPSCoord.dLongitude,
370 stConvertCoord.nZone,
371 stConvertCoord.bWithinNorthernHemisphere,
372 stConvertCoord.dEasting,
373 stConvertCoord.dNorthing,
374 stConvertCoord.dMeridianConvergence,
375 stConvertCoord.dScale);
376 }
377 catch (const GeographicLib::GeographicErr::exception& geError)
378 {
379 // Submit logger message.
380 LOG_ERROR(logging::g_qSharedLogger, "Unable to forward solve a GPSCoordinate to UTMCoordinate. GeographicLib error is: {}", geError.what());
381 }
382
383 // Return the converted UTM coordinate.
384 return stConvertCoord;
385 }
This struct stores/contains information about a UTM coordinate.
Definition GeospatialOperations.hpp:244
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
397 {
398 // Create instance variables.
399 GPSCoordinate stConvertCoord;
400
401 // Get data out of the UTM coord and repackage it into the GPS struct.
402 stConvertCoord.d2DAccuracy = stUTMCoord.d2DAccuracy;
403 stConvertCoord.d3DAccuracy = stUTMCoord.d3DAccuracy;
404 stConvertCoord.dAltitude = stUTMCoord.dAltitude;
405 stConvertCoord.eCoordinateAccuracyFixType = stUTMCoord.eCoordinateAccuracyFixType;
406 stConvertCoord.bIsDifferential = stUTMCoord.bIsDifferential;
407 stConvertCoord.tmTimestamp = stUTMCoord.tmTimestamp;
408
409 // Catch errors from GeographicLib.
410 try
411 {
412 // Reverse solve for the UTM coord.
413 GeographicLib::UTMUPS::Reverse(stUTMCoord.nZone,
414 stUTMCoord.bWithinNorthernHemisphere,
415 std::fabs(stUTMCoord.dEasting),
416 stUTMCoord.dNorthing,
417 stConvertCoord.dLatitude,
418 stConvertCoord.dLongitude,
419 stConvertCoord.dMeridianConvergence,
420 stConvertCoord.dScale);
421 }
422 catch (const GeographicLib::GeographicErr::exception& geError)
423 {
424 // Submit logger message.
425 LOG_ERROR(logging::g_qSharedLogger, "Unable to reverse solve a UTMCoordinate to GPSCoordinate. GeographicLib error is: {}", geError.what());
426 }
427
428 // Return the converted UTM coordinate.
429 return stConvertCoord;
430 }
This struct stores/contains information about a GPS data.
Definition GeospatialOperations.hpp:148
Here is the caller graph for this function:

◆ CalculateGeoMeasurement() [1/2]

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
446 {
447 // Create instance variables.
448 GeoMeasurement stMeasurements;
449
450 // Construct a geodesic with earth characteristics. (Radius and flattening)
451 // The WGS84 standard is widely used and aligns with Google Maps.
452 GeographicLib::Geodesic geGeodesic = GeographicLib::Geodesic::WGS84();
453
454 // Solve the inverse geodesic for distance and arc length degrees at the center of the globe, and relative bearings.
455 stMeasurements.dArcLengthDegrees = geGeodesic.Inverse(stCoord1.dLatitude,
456 stCoord1.dLongitude,
457 stCoord2.dLatitude,
458 stCoord2.dLongitude,
459 stMeasurements.dDistanceMeters,
460 stMeasurements.dStartRelativeBearing,
461 stMeasurements.dEndRelativeBearing);
462
463 // 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
464 // location) away from point 1. (If you want the direction to point 1, add ±180° to azi2.)
465 // Map the -180, 180 range of the azimuths to 0, 360, with both points zeroed at North.
466 stMeasurements.dStartRelativeBearing = std::fmod((stMeasurements.dStartRelativeBearing + 360), 360);
467 stMeasurements.dEndRelativeBearing = std::fmod((stMeasurements.dEndRelativeBearing + 180), 360);
468 // Ensure the result angle is positive.
469 if (stMeasurements.dStartRelativeBearing < 0)
470 {
471 // Add 360 degrees.
472 stMeasurements.dStartRelativeBearing += 360;
473 }
474 // Ensure the result angle is positive.
475 if (stMeasurements.dEndRelativeBearing < 0)
476 {
477 // Add 360 degrees.
478 stMeasurements.dEndRelativeBearing += 360;
479 }
480
481 // Return result distance.
482 return stMeasurements;
483 }
This struct is used to store the distance, arc length, and relative bearing for a calculated geodesic...
Definition GeospatialOperations.hpp:82
Here is the caller graph for this function:

◆ CalculateGeoMeasurement() [2/2]

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
499 {
500 // Create instance variables.
501 GeoMeasurement stMeasurements;
502
503 // Construct a geodesic with earth characteristics. (Radius and flattening)
504 // The WGS84 standard is widely used and aligns with Google Maps.
505 GeographicLib::Geodesic geGeodesic = GeographicLib::Geodesic::WGS84();
506
507 // Convert the given UTM coords into GPS coords for temporary use.
508 GPSCoordinate stGPSCoord1 = ConvertUTMToGPS(stCoord1);
509 GPSCoordinate stGPSCoord2 = ConvertUTMToGPS(stCoord2);
510
511 // Solve the inverse geodesic.
512 stMeasurements.dArcLengthDegrees = geGeodesic.Inverse(stGPSCoord1.dLatitude,
513 stGPSCoord1.dLongitude,
514 stGPSCoord2.dLatitude,
515 stGPSCoord2.dLongitude,
516 stMeasurements.dDistanceMeters,
517 stMeasurements.dStartRelativeBearing,
518 stMeasurements.dEndRelativeBearing);
519
520 // 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
521 // location) away from point 1. (If you want the direction to point 1, add ±180° to azi2.)
522 // Map the -180, 180 range of the azimuths to 0, 360, with both points zeroed at North.
523 stMeasurements.dStartRelativeBearing = std::fmod((stMeasurements.dStartRelativeBearing + 360), 360);
524 stMeasurements.dEndRelativeBearing = std::fmod((stMeasurements.dEndRelativeBearing + 180), 360);
525 // Ensure the result angle is positive.
526 if (stMeasurements.dStartRelativeBearing < 0)
527 {
528 // Add 360 degrees.
529 stMeasurements.dStartRelativeBearing += 360;
530 }
531 // Ensure the result angle is positive.
532 if (stMeasurements.dEndRelativeBearing < 0)
533 {
534 // Add 360 degrees.
535 stMeasurements.dEndRelativeBearing += 360;
536 }
537
538 // Return result distance.
539 return stMeasurements;
540 }
GPSCoordinate ConvertUTMToGPS(const UTMCoordinate &stUTMCoord)
Given a UTM coordinate, convert to GPS and create a new GPSCoordinate object.
Definition GeospatialOperations.hpp:396
Here is the call graph for this function: