Common getter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1 and v2.1.1.
More...
#include <GeographicLib/UTMUPS.hpp>
Go to the source code of this file.
|
uint32_t | getStationID (const ItsPduHeader &header) |
| Get the StationID of ItsPduHeader.
|
|
double | getLatitude (const Latitude &latitude) |
| Get the Latitude value.
|
|
double | getLongitude (const Longitude &longitude) |
| Get the Longitude value.
|
|
double | getAltitude (const Altitude &altitude) |
| Get the Altitude value.
|
|
double | getSpeed (const Speed &speed) |
| Get the vehicle speed.
|
|
template<typename T> |
gm::PointStamped | getUTMPosition (const T &reference_position, int &zone, bool &northp) |
| Get the UTM Position defined by the given ReferencePosition.
|
|
Common getter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1 and v2.1.1.
Definition in file cdd_getters_common.h.
◆ getAltitude()
double getAltitude |
( |
const Altitude & | altitude | ) |
|
|
inline |
Get the Altitude value.
- Parameters
-
altitude | to get the Altitude value from |
- Returns
- Altitude value (above the reference ellipsoid surface) in meter as decimal number
Definition at line 67 of file cdd_getters_common.h.
67{ return ((double)altitude.altitude_value.value) * 1e-2; }
◆ getLatitude()
double getLatitude |
( |
const Latitude & | latitude | ) |
|
|
inline |
Get the Latitude value.
- Parameters
-
latitude | to get the Latitude value from |
- Returns
- Latitude value in degree as decimal number
Definition at line 51 of file cdd_getters_common.h.
51{ return ((double)latitude.value) * 1e-7; }
◆ getLongitude()
double getLongitude |
( |
const Longitude & | longitude | ) |
|
|
inline |
Get the Longitude value.
- Parameters
-
longitude | to get the Longitude value from |
- Returns
- Longitude value in degree as decimal number
Definition at line 59 of file cdd_getters_common.h.
59{ return ((double)longitude.value) * 1e-7; }
◆ getSpeed()
double getSpeed |
( |
const Speed & | speed | ) |
|
|
inline |
Get the vehicle speed.
- Parameters
-
speed | to get the speed value from |
- Returns
- speed value in m/s as decimal number
Definition at line 75 of file cdd_getters_common.h.
75{ return ((double)speed.speed_value.value) * 1e-2; }
◆ getStationID()
uint32_t getStationID |
( |
const ItsPduHeader & | header | ) |
|
|
inline |
Get the StationID of ItsPduHeader.
- Parameters
-
header | ItsPduHeader to get the StationID value from |
- Returns
- stationID value
Definition at line 43 of file cdd_getters_common.h.
43{ return header.station_id.value; }
◆ getUTMPosition()
template<typename T>
gm::PointStamped getUTMPosition |
( |
const T & | reference_position, |
|
|
int & | zone, |
|
|
bool & | northp ) |
|
inline |
Get the UTM Position defined by the given ReferencePosition.
The position is transformed into UTM by using GeographicLib::UTMUPS The altitude value is directly used as z-Coordinate
- Parameters
-
[in] | reference_position | ReferencePosition or ReferencePositionWithConfidence to get the UTM Position from |
[out] | zone | the UTM zone (zero means UPS) |
[out] | northp | hemisphere (true means north, false means south) |
- Returns
- gm::PointStamped geometry_msgs::PointStamped of the given position
Definition at line 89 of file cdd_getters_common.h.
89 {
90 gm::PointStamped utm_point;
91 double latitude =
getLatitude(reference_position.latitude);
92 double longitude =
getLongitude(reference_position.longitude);
93 utm_point.point.z =
getAltitude(reference_position.altitude);
94 try {
95 GeographicLib::UTMUPS::Forward(latitude, longitude, zone, northp, utm_point.point.x, utm_point.point.y);
96 std::string hemisphere;
97 if (northp) {
98 hemisphere = "N";
99 } else {
100 hemisphere = "S";
101 }
102 utm_point.header.frame_id = "utm_" + std::to_string(zone) + hemisphere;
103 } catch (GeographicLib::GeographicErr& e) {
104 throw std::invalid_argument(e.what());
105 }
106 return utm_point;
107}
double getLatitude(const Latitude &latitude)
Get the Latitude value.
double getLongitude(const Longitude &longitude)
Get the Longitude value.
double getAltitude(const Altitude &altitude)
Get the Altitude value.