etsi_its_messages v3.4.0
Loading...
Searching...
No Matches
mcm_getters.h File Reference

Getter functions for the UULM MCM (TR). More...

Go to the source code of this file.

Functions

double etsi_its_mcm_uulm_msgs::access::getLatitude (const Latitude &latitude)
 Get the Latitude value.
double etsi_its_mcm_uulm_msgs::access::getLongitude (const Longitude &longitude)
 Get the Longitude value.
double etsi_its_mcm_uulm_msgs::access::getAltitude (const Altitude &altitude)
 Get the Altitude value.
template<typename T>
gm::PointStamped etsi_its_mcm_uulm_msgs::access::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.
gm::PointStamped etsi_its_mcm_uulm_msgs::access::getUTMPosition (const MCM &mcm, int &zone, bool &northp, double &conv_angle)
 Get the UTM Position defined within the BasicContainer of the MCM along with the grid-convergence angle.
gm::PointStamped etsi_its_mcm_uulm_msgs::access::getUTMPosition (const MCM &mcm, int &zone, bool &northp)
 Get the UTM Position defined within the BasicContainer of the MCM.
gm::PointStamped etsi_its_mcm_uulm_msgs::access::getUTMPosition (const MCM &mcm)
 Get the UTM Position defined within the BasicContainer of the MCM.
SuggestedManeuverContainer etsi_its_mcm_uulm_msgs::access::getSuggestedManeuverContainer (const MCM &mcm)
 Retrieves the SuggestedManeuverContainer from the given MCM object.
uint32_t etsi_its_mcm_uulm_msgs::access::getTargetStationId (const SuggestedManeuverContainer &suggested_maneuver_container)
 Retrieves the target station ID from a SuggestedManeuverContainer.
SuggestedManeuver etsi_its_mcm_uulm_msgs::access::getSuggestedManeuver (const SuggestedManeuverContainer &suggested_maneuver_container)
 Retrieves the suggested maneuver from a SuggestedManeuverContainer.
SuggestedManeuver etsi_its_mcm_uulm_msgs::access::getSuggestedManeuver (const MCM &mcm)
 Retrieves the suggested maneuver from the given MCM message.
uint16_t etsi_its_mcm_uulm_msgs::access::getManeuverId (const SuggestedManeuver &suggested_maneuver)
 Retrieves the maneuver ID from a SuggestedManeuver object.
uint16_t etsi_its_mcm_uulm_msgs::access::getAdviceUpdateId (const SuggestedManeuver &suggested_maneuver)
 Retrieves the advice update identifier from a SuggestedManeuver object.
bool etsi_its_mcm_uulm_msgs::access::getConfirmationRequiredFlag (const SuggestedManeuver &suggested_maneuver)
 Retrieves the confirmation required flag from a SuggestedManeuver.
ManeuverConstraints etsi_its_mcm_uulm_msgs::access::getManeuverConstraints (const SuggestedManeuver &suggested_maneuver)
 Retrieves the ManeuverConstraints from a SuggestedManeuver.
ManeuverConstraints etsi_its_mcm_uulm_msgs::access::getManeuverConstraints (const MCM &mcm)
 Retrieves the maneuver constraints from a given MCM (Maneuver Coordination Message).
std::vector< LongitudinalWaypoint > etsi_its_mcm_uulm_msgs::access::getLongitudinalWaypoints (const ManeuverConstraints &maneuver_constraints)
 Retrieves the list of longitudinal waypoints from the given maneuver constraints.
std::vector< LongitudinalWaypoint > etsi_its_mcm_uulm_msgs::access::getLongitudinalWaypoints (const MCM &mcm)
 Retrieves the longitudinal waypoints from the given MCM (Maneuver Coordination Message).
gm::Point etsi_its_mcm_uulm_msgs::access::getWaypointDelta (const LongitudinalWaypoint &longitudinal_waypoint)
 Converts a LongitudinalWaypoint to a gm::Point.
double etsi_its_mcm_uulm_msgs::access::getMinArrivalTimeDelta (const LongitudinalWaypoint &longitudinal_waypoint)
 Returns the minimum arrival time delta for a given longitudinal waypoint.
double etsi_its_mcm_uulm_msgs::access::getMaxArrivalTimeDelta (const LongitudinalWaypoint &longitudinal_waypoint)
 Returns the maximum allowed arrival time delta for a given longitudinal waypoint.
double etsi_its_mcm_uulm_msgs::access::getMinVelocity (const LongitudinalWaypoint &longitudinal_waypoint)
 Retrieves the minimum velocity from a LongitudinalWaypoint.
double etsi_its_mcm_uulm_msgs::access::getMaxVelocity (const LongitudinalWaypoint &longitudinal_waypoint)
 Retrieves the maximum velocity from a LongitudinalWaypoint object.
RoadUserContainer etsi_its_mcm_uulm_msgs::access::getRoadUserContainer (const MCM &mcm)
 Retrieves the RoadUserContainer from the given MCM object.

Detailed Description

Getter functions for the UULM MCM (TR).

Definition in file mcm_getters.h.

Function Documentation

◆ getAdviceUpdateId()

uint16_t etsi_its_mcm_uulm_msgs::access::getAdviceUpdateId ( const SuggestedManeuver & suggested_maneuver)
inline

Retrieves the advice update identifier from a SuggestedManeuver object.

Parameters
suggested_maneuverThe SuggestedManeuver object containing the advice update ID.
Returns
The advice update ID as a uint16_t.

Definition at line 192 of file mcm_getters.h.

192 {
193 return suggested_maneuver.advice_update_id.value;
194}

◆ getAltitude()

double etsi_its_mcm_uulm_msgs::access::getAltitude ( const Altitude & altitude)
inline

Get the Altitude value.

Parameters
altitudeto get the Altitude value from
Returns
Altitude value (above the reference ellipsoid surface) in meter as decimal number (0 if unavailable)

Definition at line 35 of file mcm_getters.h.

35 {
36 if (altitude.altitude_value.value == AltitudeValue::UNAVAILABLE) {
37 return 0.0;
38 }
39
40 return ((double)altitude.altitude_value.value) * 1e-2;
41}

◆ getConfirmationRequiredFlag()

bool etsi_its_mcm_uulm_msgs::access::getConfirmationRequiredFlag ( const SuggestedManeuver & suggested_maneuver)
inline

Retrieves the confirmation required flag from a SuggestedManeuver.

Parameters
suggested_maneuverThe SuggestedManeuver object to query.
Returns
true if confirmation is required, false otherwise.

Definition at line 202 of file mcm_getters.h.

202 {
203 return suggested_maneuver.confirmation_required_flag.value;
204}

◆ getLatitude()

double etsi_its_mcm_uulm_msgs::access::getLatitude ( const Latitude & latitude)
inline

Get the Latitude value.

Parameters
latitudeto get the Latitude value from
Returns
Latitude value in degree as decimal number

Definition at line 19 of file mcm_getters.h.

19{ return ((double)latitude.value) * 1e-7; }

◆ getLongitude()

double etsi_its_mcm_uulm_msgs::access::getLongitude ( const Longitude & longitude)
inline

Get the Longitude value.

Parameters
longitudeto get the Longitude value from
Returns
Longitude value in degree as decimal number

Definition at line 27 of file mcm_getters.h.

27{ return ((double)longitude.value) * 1e-7; }

◆ getLongitudinalWaypoints() [1/2]

std::vector< LongitudinalWaypoint > etsi_its_mcm_uulm_msgs::access::getLongitudinalWaypoints ( const ManeuverConstraints & maneuver_constraints)
inline

Retrieves the list of longitudinal waypoints from the given maneuver constraints.

Parameters
maneuver_constraintsThe ManeuverConstraints object containing the waypoints.
Returns
std::vector<LongitudinalWaypoint> The vector of longitudinal waypoints.

Definition at line 236 of file mcm_getters.h.

236 {
237 return maneuver_constraints.longitudinal_maneuver_waypoint_container.array;
238}

◆ getLongitudinalWaypoints() [2/2]

std::vector< LongitudinalWaypoint > etsi_its_mcm_uulm_msgs::access::getLongitudinalWaypoints ( const MCM & mcm)
inline

Retrieves the longitudinal waypoints from the given MCM (Maneuver Coordination Message).

Parameters
mcmThe Maneuver Coordination Message from which to extract waypoints.
Returns
A vector of LongitudinalWaypoint objects representing the waypoints.

Definition at line 246 of file mcm_getters.h.

246 {
248}
std::vector< LongitudinalWaypoint > getLongitudinalWaypoints(const ManeuverConstraints &maneuver_constraints)
Retrieves the list of longitudinal waypoints from the given maneuver constraints.
ManeuverConstraints getManeuverConstraints(const SuggestedManeuver &suggested_maneuver)
Retrieves the ManeuverConstraints from a SuggestedManeuver.

◆ getManeuverConstraints() [1/2]

ManeuverConstraints etsi_its_mcm_uulm_msgs::access::getManeuverConstraints ( const MCM & mcm)
inline

Retrieves the maneuver constraints from a given MCM (Maneuver Coordination Message).

Parameters
mcmThe Maneuver Coordination Message from which to extract constraints.
Returns
ManeuverConstraints The constraints associated with the suggested maneuver.

Definition at line 226 of file mcm_getters.h.

226 {
228}
SuggestedManeuver getSuggestedManeuver(const SuggestedManeuverContainer &suggested_maneuver_container)
Retrieves the suggested maneuver from a SuggestedManeuverContainer.

◆ getManeuverConstraints() [2/2]

ManeuverConstraints etsi_its_mcm_uulm_msgs::access::getManeuverConstraints ( const SuggestedManeuver & suggested_maneuver)
inline

Retrieves the ManeuverConstraints from a SuggestedManeuver.

Parameters
suggested_maneuverThe SuggestedManeuver object from which to extract the constraints.
Returns
ManeuverConstraints The maneuver constraints contained in the SuggestedManeuver.
Exceptions
std::invalid_argumentIf the SuggestedManeuver does not have maneuver constraints present.

Definition at line 213 of file mcm_getters.h.

213 {
214 if (suggested_maneuver.maneuver_parameters.choice != ManeuverParameters::CHOICE_MANEUVER_CONSTRAINTS) {
215 throw std::invalid_argument("No maneuver constraints present in SuggestedManeuver");
216 }
217 return suggested_maneuver.maneuver_parameters.maneuver_constraints;
218}

◆ getManeuverId()

uint16_t etsi_its_mcm_uulm_msgs::access::getManeuverId ( const SuggestedManeuver & suggested_maneuver)
inline

Retrieves the maneuver ID from a SuggestedManeuver object.

Parameters
suggested_maneuverThe SuggestedManeuver instance to extract the maneuver ID from.
Returns
The maneuver ID as a uint16_t.

Definition at line 182 of file mcm_getters.h.

182 {
183 return suggested_maneuver.maneuver_id.value;
184}

◆ getMaxArrivalTimeDelta()

double etsi_its_mcm_uulm_msgs::access::getMaxArrivalTimeDelta ( const LongitudinalWaypoint & longitudinal_waypoint)
inline

Returns the maximum allowed arrival time delta for a given longitudinal waypoint.

Parameters
longitudinal_waypointThe waypoint containing the maximum arrival time in milliseconds.
Returns
The maximum arrival time delta in seconds.

Definition at line 280 of file mcm_getters.h.

280 {
281 return static_cast<double>(longitudinal_waypoint.max_arrival_time.value * 1e-3); // convert ms to s
282}

◆ getMaxVelocity()

double etsi_its_mcm_uulm_msgs::access::getMaxVelocity ( const LongitudinalWaypoint & longitudinal_waypoint)
inline

Retrieves the maximum velocity from a LongitudinalWaypoint object.

Parameters
longitudinal_waypointThe LongitudinalWaypoint object containing velocity information in cm/s.
Returns
The maximum velocity in m/s, or NaN if unavailable.
Exceptions
std::invalid_argumentIf the maximum velocity is not present.

Definition at line 307 of file mcm_getters.h.

307 {
308 if (!longitudinal_waypoint.max_velocity_is_present) {
309 throw std::invalid_argument("No max velocity present in LongitudinalWaypoint");
310 } else if (longitudinal_waypoint.max_velocity.value == SpeedValue::UNAVAILABLE) {
311 return std::numeric_limits<double>::quiet_NaN();
312 }
313 return static_cast<double>(longitudinal_waypoint.max_velocity.value * 1e-2); // convert cm/s to m/s
314}

◆ getMinArrivalTimeDelta()

double etsi_its_mcm_uulm_msgs::access::getMinArrivalTimeDelta ( const LongitudinalWaypoint & longitudinal_waypoint)
inline

Returns the minimum arrival time delta for a given longitudinal waypoint.

Parameters
longitudinal_waypointThe waypoint containing the minimum arrival time in milliseconds.
Returns
The minimum arrival time delta in seconds.

Definition at line 270 of file mcm_getters.h.

270 {
271 return static_cast<double>(longitudinal_waypoint.min_arrival_time.value * 1e-3); // convert ms to s
272}

◆ getMinVelocity()

double etsi_its_mcm_uulm_msgs::access::getMinVelocity ( const LongitudinalWaypoint & longitudinal_waypoint)
inline

Retrieves the minimum velocity from a LongitudinalWaypoint.

Parameters
longitudinal_waypointThe LongitudinalWaypoint containing the velocity information in cm/s.
Returns
The minimum velocity in m/s, or NaN if unavailable.
Exceptions
std::invalid_argumentIf the minimum velocity is not present.

Definition at line 291 of file mcm_getters.h.

291 {
292 if (!longitudinal_waypoint.min_velocity_is_present) {
293 throw std::invalid_argument("No min velocity present in LongitudinalWaypoint");
294 } else if (longitudinal_waypoint.min_velocity.value == SpeedValue::UNAVAILABLE) {
295 return std::numeric_limits<double>::quiet_NaN();
296 }
297 return static_cast<double>(longitudinal_waypoint.min_velocity.value * 1e-2); // convert cm/s to m/s
298}

◆ getRoadUserContainer()

RoadUserContainer etsi_its_mcm_uulm_msgs::access::getRoadUserContainer ( const MCM & mcm)
inline

Retrieves the RoadUserContainer from the given MCM object.

Parameters
mcmThe MCM object from which to retrieve the RoadUserContainer.
Returns
RoadUserContainer The extracted RoadUserContainer.
Exceptions
std::invalid_argumentIf the MCM does not contain a RoadUserContainer.

Definition at line 325 of file mcm_getters.h.

325 {
326 if (mcm.mcm.mcm_parameters.maneuver_container.choice != ManeuverContainer::CHOICE_ROAD_USER_CONTAINER) {
327 throw std::invalid_argument("No road user container present in MCM");
328 }
329 return mcm.mcm.mcm_parameters.maneuver_container.road_user_container;
330}

◆ getSuggestedManeuver() [1/2]

SuggestedManeuver etsi_its_mcm_uulm_msgs::access::getSuggestedManeuver ( const MCM & mcm)
inline

Retrieves the suggested maneuver from the given MCM message.

Parameters
mcmThe MCM (Maneuver Coordination Message) object to extract the suggested maneuver from.
Returns
SuggestedManeuver The suggested maneuver contained within the MCM message.

Definition at line 172 of file mcm_getters.h.

172 {
174}
SuggestedManeuverContainer getSuggestedManeuverContainer(const MCM &mcm)
Retrieves the SuggestedManeuverContainer from the given MCM object.

◆ getSuggestedManeuver() [2/2]

SuggestedManeuver etsi_its_mcm_uulm_msgs::access::getSuggestedManeuver ( const SuggestedManeuverContainer & suggested_maneuver_container)
inline

Retrieves the suggested maneuver from a SuggestedManeuverContainer.

Parameters
suggested_maneuver_containerThe container holding the suggested maneuver.
Returns
SuggestedManeuver The suggested maneuver contained in the input.
Exceptions
std::invalid_argumentIf no suggested maneuver is present in the container.

Definition at line 159 of file mcm_getters.h.

159 {
160 if (!suggested_maneuver_container.suggested_maneuver_is_present) {
161 throw std::invalid_argument("No suggested maneuver present in SuggestedManeuverContainer");
162 }
163 return suggested_maneuver_container.suggested_maneuver;
164}

◆ getSuggestedManeuverContainer()

SuggestedManeuverContainer etsi_its_mcm_uulm_msgs::access::getSuggestedManeuverContainer ( const MCM & mcm)
inline

Retrieves the SuggestedManeuverContainer from the given MCM object.

Parameters
mcmThe MCM object from which to extract the suggested maneuver container.
Returns
SuggestedManeuverContainer The extracted suggested maneuver container.
Exceptions
std::invalid_argumentIf the maneuver container does not contain a suggested maneuver container.

Definition at line 135 of file mcm_getters.h.

135 {
136 if (mcm.mcm.mcm_parameters.maneuver_container.choice != ManeuverContainer::CHOICE_SUGGESTED_MANEUVER_CONTAINER) {
137 throw std::invalid_argument("No suggested maneuver container present in MCM");
138 }
139 return mcm.mcm.mcm_parameters.maneuver_container.suggested_maneuver_container;
140}

◆ getTargetStationId()

uint32_t etsi_its_mcm_uulm_msgs::access::getTargetStationId ( const SuggestedManeuverContainer & suggested_maneuver_container)
inline

Retrieves the target station ID from a SuggestedManeuverContainer.

Parameters
suggested_maneuver_containerThe container holding the suggested maneuver information.
Returns
The target station ID as a uint32_t.

Definition at line 148 of file mcm_getters.h.

148 {
149 return suggested_maneuver_container.target_station_id.value;
150}

◆ getUTMPosition() [1/4]

gm::PointStamped etsi_its_mcm_uulm_msgs::access::getUTMPosition ( const MCM & mcm)
inline

Get the UTM Position defined within the BasicContainer of the MCM.

The position is transformed into UTM by using GeographicLib::UTMUPS The altitude value is directly used as z-Coordinate

Parameters
[in]mcmMCM to get the UTM Position from
Returns
gm::PointStamped geometry_msgs::PointStamped of the given position

Definition at line 119 of file mcm_getters.h.

119 {
120 int zone; // unused, but required by the function signature
121 bool northp; // unused, but required by the function signature
122 double conv_angle; // unused, but required by the function signature
123 return getUTMPosition(mcm.mcm.mcm_parameters.basic_container.reference_position, zone, northp, conv_angle);
124}
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.
Definition mcm_getters.h:56

◆ getUTMPosition() [2/4]

gm::PointStamped etsi_its_mcm_uulm_msgs::access::getUTMPosition ( const MCM & mcm,
int & zone,
bool & northp )
inline

Get the UTM Position defined within the BasicContainer of the MCM.

The position is transformed into UTM by using GeographicLib::UTMUPS The altitude value is directly used as z-Coordinate

Parameters
[in]mcmMCM to get the UTM Position from
[out]zonethe UTM zone (zero means UPS)
[out]northphemisphere (true means north, false means south)
Returns
gm::PointStamped geometry_msgs::PointStamped of the given position

Definition at line 105 of file mcm_getters.h.

105 {
106 double conv_angle; // unused, but required by the function signature
107 return getUTMPosition(mcm.mcm.mcm_parameters.basic_container.reference_position, zone, northp, conv_angle);
108}

◆ getUTMPosition() [3/4]

gm::PointStamped etsi_its_mcm_uulm_msgs::access::getUTMPosition ( const MCM & mcm,
int & zone,
bool & northp,
double & conv_angle )
inline

Get the UTM Position defined within the BasicContainer of the MCM along with the grid-convergence angle.

The position is transformed into UTM by using GeographicLib::UTMUPS The altitude value is directly used as z-Coordinate

Parameters
[in]mcmMCM to get the UTM Position from
[out]zonethe UTM zone (zero means UPS)
[out]northphemisphere (true means north, false means south)
[out]conv_anglegrid-convergence angle in degree
Returns
gm::PointStamped geometry_msgs::PointStamped of the given position

Definition at line 90 of file mcm_getters.h.

90 {
91 return getUTMPosition(mcm.mcm.mcm_parameters.basic_container.reference_position, zone, northp, conv_angle);
92}

◆ getUTMPosition() [4/4]

template<typename T>
gm::PointStamped etsi_its_mcm_uulm_msgs::access::getUTMPosition ( const T & reference_position,
int & zone,
bool & northp,
double & conv_angle )
inline

Get the UTM Position defined by the given ReferencePosition along with the grid-convergence angle.

The position is transformed into UTM by using GeographicLib::UTMUPS The altitude value is directly used as z-Coordinate

Parameters
[in]reference_positionReferencePosition or ReferencePositionWithConfidence to get the UTM Position from
[out]zonethe UTM zone (zero means UPS)
[out]northphemisphere (true means north, false means south)
[out]conv_anglegrid-convergence angle in degree
Returns
gm::PointStamped geometry_msgs::PointStamped of the given position

Definition at line 56 of file mcm_getters.h.

56 {
57 gm::PointStamped utm_point;
58 double latitude = getLatitude(reference_position.latitude);
59 double longitude = getLongitude(reference_position.longitude);
60 utm_point.point.z = getAltitude(reference_position.altitude);
61 try {
62 double scale;
63 GeographicLib::UTMUPS::Forward(latitude, longitude, zone, northp, utm_point.point.x, utm_point.point.y, conv_angle,
64 scale);
65 std::string hemisphere;
66 if (northp) {
67 hemisphere = "N";
68 } else {
69 hemisphere = "S";
70 }
71 utm_point.header.frame_id = "utm_" + std::to_string(zone) + hemisphere;
72 } catch (GeographicLib::GeographicErr& e) {
73 throw std::invalid_argument(e.what());
74 }
75 return utm_point;
76}
double getLatitude(const Latitude &latitude)
Get the Latitude value.
Definition mcm_getters.h:19
double getAltitude(const Altitude &altitude)
Get the Altitude value.
Definition mcm_getters.h:35
double getLongitude(const Longitude &longitude)
Get the Longitude value.
Definition mcm_getters.h:27

◆ getWaypointDelta()

gm::Point etsi_its_mcm_uulm_msgs::access::getWaypointDelta ( const LongitudinalWaypoint & longitudinal_waypoint)
inline

Converts a LongitudinalWaypoint to a gm::Point.

Parameters
longitudinal_waypointThe LongitudinalWaypoint containing x and y distances in centimeters.
Returns
gm::Point The point with x and y coordinates in meters, and z set to 0.0.

Definition at line 256 of file mcm_getters.h.

256 {
257 gm::Point point;
258 point.x = static_cast<double>(longitudinal_waypoint.waypoint.x_distance.value * 1e-2); // convert cm to m
259 point.y = static_cast<double>(longitudinal_waypoint.waypoint.y_distance.value * 1e-2); // convert cm to m
260 point.z = 0.0; // z-coordinate is not used in longitudinal waypoints
261 return point;
262}