32#ifndef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_GETTERS_COMMON_H
33#define ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_GETTERS_COMMON_H
35#include <GeographicLib/UTMUPS.hpp>
43inline uint32_t
getStationID(
const ItsPduHeader& header) {
return header.station_id.value; }
51inline double getLatitude(
const Latitude& latitude) {
return ((
double)latitude.value) * 1e-7; }
59inline double getLongitude(
const Longitude& longitude) {
return ((
double)longitude.value) * 1e-7; }
67inline double getAltitude(
const Altitude& altitude) {
return ((
double)altitude.altitude_value.value) * 1e-2; }
75inline double getSpeed(
const Speed& speed) {
return ((
double)speed.speed_value.value) * 1e-2; }
89inline gm::PointStamped
getUTMPosition(
const T& reference_position,
int& zone,
bool& northp) {
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);
95 GeographicLib::UTMUPS::Forward(latitude, longitude, zone, northp, utm_point.point.x, utm_point.point.y);
96 std::string hemisphere;
102 utm_point.header.frame_id =
"utm_" + std::to_string(zone) + hemisphere;
103 }
catch (GeographicLib::GeographicErr& e) {
104 throw std::invalid_argument(e.what());
gm::PointStamped getUTMPosition(const T &reference_position, int &zone, bool &northp)
Get the UTM Position defined by the given ReferencePosition.
double getLatitude(const Latitude &latitude)
Get the Latitude value.
double getLongitude(const Longitude &longitude)
Get the Longitude value.
uint32_t getStationID(const ItsPduHeader &header)
Get the StationID of ItsPduHeader.
double getAltitude(const Altitude &altitude)
Get the Altitude value.
double getSpeed(const Speed &speed)
Get the vehicle speed.