34namespace etsi_its_mcm_uulm_msgs::access {
42inline double getLatitude(
const Latitude& latitude) {
return ((
double)latitude.value) * 1e-7; }
50inline double getLongitude(
const Longitude& longitude) {
return ((
double)longitude.value) * 1e-7; }
59 if (altitude.altitude_value.value == AltitudeValue::UNAVAILABLE) {
63 return ((
double)altitude.altitude_value.value) * 1e-2;
79inline gm::PointStamped
getUTMPosition(
const T& reference_position,
int& zone,
bool& northp,
double& conv_angle) {
80 gm::PointStamped utm_point;
81 double latitude =
getLatitude(reference_position.latitude);
82 double longitude =
getLongitude(reference_position.longitude);
83 utm_point.point.z =
getAltitude(reference_position.altitude);
86 GeographicLib::UTMUPS::Forward(latitude, longitude, zone, northp, utm_point.point.x, utm_point.point.y, conv_angle,
88 std::string hemisphere;
94 utm_point.header.frame_id =
"utm_" + std::to_string(zone) + hemisphere;
95 }
catch (GeographicLib::GeographicErr& e) {
96 throw std::invalid_argument(e.what());
113inline gm::PointStamped
getUTMPosition(
const MCM& mcm,
int& zone,
bool& northp,
double& conv_angle) {
114 return getUTMPosition(mcm.mcm.mcm_parameters.basic_container.reference_position, zone, northp, conv_angle);
130 return getUTMPosition(mcm.mcm.mcm_parameters.basic_container.reference_position, zone, northp, conv_angle);
146 return getUTMPosition(mcm.mcm.mcm_parameters.basic_container.reference_position, zone, northp, conv_angle);
159 if (mcm.mcm.mcm_parameters.maneuver_container.choice != ManeuverContainer::CHOICE_SUGGESTED_MANEUVER_CONTAINER) {
160 throw std::invalid_argument(
"No suggested maneuver container present in MCM");
162 return mcm.mcm.mcm_parameters.maneuver_container.suggested_maneuver_container;
172 return suggested_maneuver_container.target_station_id.value;
183 if (!suggested_maneuver_container.suggested_maneuver_is_present) {
184 throw std::invalid_argument(
"No suggested maneuver present in SuggestedManeuverContainer");
186 return suggested_maneuver_container.suggested_maneuver;
206 return suggested_maneuver.maneuver_id.value;
216 return suggested_maneuver.advice_update_id.value;
226 return suggested_maneuver.confirmation_required_flag.value;
237 if (suggested_maneuver.maneuver_parameters.choice != ManeuverParameters::CHOICE_MANEUVER_CONSTRAINTS) {
238 throw std::invalid_argument(
"No maneuver constraints present in SuggestedManeuver");
240 return suggested_maneuver.maneuver_parameters.maneuver_constraints;
260 return maneuver_constraints.longitudinal_maneuver_waypoint_container.array;
281 point.x =
static_cast<double>(longitudinal_waypoint.waypoint.x_distance.value * 1e-2);
282 point.y =
static_cast<double>(longitudinal_waypoint.waypoint.y_distance.value * 1e-2);
294 return static_cast<double>(longitudinal_waypoint.min_arrival_time.value * 1e-3);
304 return static_cast<double>(longitudinal_waypoint.max_arrival_time.value * 1e-3);
315 if (!longitudinal_waypoint.min_velocity_is_present) {
316 throw std::invalid_argument(
"No min velocity present in LongitudinalWaypoint");
317 }
else if (longitudinal_waypoint.min_velocity.value == SpeedValue::UNAVAILABLE) {
318 return std::numeric_limits<double>::quiet_NaN();
320 return static_cast<double>(longitudinal_waypoint.min_velocity.value * 1e-2);
331 if (!longitudinal_waypoint.max_velocity_is_present) {
332 throw std::invalid_argument(
"No max velocity present in LongitudinalWaypoint");
333 }
else if (longitudinal_waypoint.max_velocity.value == SpeedValue::UNAVAILABLE) {
334 return std::numeric_limits<double>::quiet_NaN();
336 return static_cast<double>(longitudinal_waypoint.max_velocity.value * 1e-2);
349 if (mcm.mcm.mcm_parameters.maneuver_container.choice != ManeuverContainer::CHOICE_ROAD_USER_CONTAINER) {
350 throw std::invalid_argument(
"No road user container present in MCM");
352 return mcm.mcm.mcm_parameters.maneuver_container.road_user_container;
std::vector< LongitudinalWaypoint > getLongitudinalWaypoints(const ManeuverConstraints &maneuver_constraints)
Retrieves the list of longitudinal waypoints from the given maneuver constraints.
double getMinVelocity(const LongitudinalWaypoint &longitudinal_waypoint)
Retrieves the minimum velocity from a LongitudinalWaypoint.
gm::Point getWaypointDelta(const LongitudinalWaypoint &longitudinal_waypoint)
Converts a LongitudinalWaypoint to a gm::Point.
double getLatitude(const Latitude &latitude)
Get the Latitude value.
uint16_t getAdviceUpdateId(const SuggestedManeuver &suggested_maneuver)
Retrieves the advice update identifier from a SuggestedManeuver object.
bool getConfirmationRequiredFlag(const SuggestedManeuver &suggested_maneuver)
Retrieves the confirmation required flag from a SuggestedManeuver.
double getMaxArrivalTimeDelta(const LongitudinalWaypoint &longitudinal_waypoint)
Returns the maximum allowed arrival time delta for a given longitudinal waypoint.
uint16_t getManeuverId(const SuggestedManeuver &suggested_maneuver)
Retrieves the maneuver ID from a SuggestedManeuver object.
double getMaxVelocity(const LongitudinalWaypoint &longitudinal_waypoint)
Retrieves the maximum velocity from a LongitudinalWaypoint object.
double getMinArrivalTimeDelta(const LongitudinalWaypoint &longitudinal_waypoint)
Returns the minimum arrival time delta for a given longitudinal waypoint.
SuggestedManeuver getSuggestedManeuver(const SuggestedManeuverContainer &suggested_maneuver_container)
Retrieves the suggested maneuver from a SuggestedManeuverContainer.
ManeuverConstraints getManeuverConstraints(const SuggestedManeuver &suggested_maneuver)
Retrieves the ManeuverConstraints from a SuggestedManeuver.
uint32_t getTargetStationId(const SuggestedManeuverContainer &suggested_maneuver_container)
Retrieves the target station ID from a SuggestedManeuverContainer.
double getAltitude(const Altitude &altitude)
Get the Altitude value.
SuggestedManeuverContainer getSuggestedManeuverContainer(const MCM &mcm)
Retrieves the SuggestedManeuverContainer from the given MCM object.
RoadUserContainer getRoadUserContainer(const MCM &mcm)
Retrieves the RoadUserContainer from the given MCM object.
double getLongitude(const Longitude &longitude)
Get the Longitude value.
gm::PointStamped getUTMPosition(const T &reference_position, int &zone, bool &northp, double &conv_angle)
Get the UTM Position defined by the given ReferencePosition along with the grid-convergence angle.