etsi_its_messages v3.3.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 215 of file mcm_getters.h.

215 {
216 return suggested_maneuver.advice_update_id.value;
217}

◆ 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 58 of file mcm_getters.h.

58 {
59 if (altitude.altitude_value.value == AltitudeValue::UNAVAILABLE) {
60 return 0.0;
61 }
62
63 return ((double)altitude.altitude_value.value) * 1e-2;
64}

◆ 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 225 of file mcm_getters.h.

225 {
226 return suggested_maneuver.confirmation_required_flag.value;
227}

◆ 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 42 of file mcm_getters.h.

42{ 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 50 of file mcm_getters.h.

50{ 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 259 of file mcm_getters.h.

259 {
260 return maneuver_constraints.longitudinal_maneuver_waypoint_container.array;
261}

◆ 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 269 of file mcm_getters.h.

269 {
271}
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 249 of file mcm_getters.h.

249 {
251}
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 236 of file mcm_getters.h.

236 {
237 if (suggested_maneuver.maneuver_parameters.choice != ManeuverParameters::CHOICE_MANEUVER_CONSTRAINTS) {
238 throw std::invalid_argument("No maneuver constraints present in SuggestedManeuver");
239 }
240 return suggested_maneuver.maneuver_parameters.maneuver_constraints;
241}

◆ 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 205 of file mcm_getters.h.

205 {
206 return suggested_maneuver.maneuver_id.value;
207}

◆ 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 303 of file mcm_getters.h.

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

◆ 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 330 of file mcm_getters.h.

330 {
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();
335 }
336 return static_cast<double>(longitudinal_waypoint.max_velocity.value * 1e-2); // convert cm/s to m/s
337}

◆ 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 293 of file mcm_getters.h.

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

◆ 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 314 of file mcm_getters.h.

314 {
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();
319 }
320 return static_cast<double>(longitudinal_waypoint.min_velocity.value * 1e-2); // convert cm/s to m/s
321}

◆ 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 348 of file mcm_getters.h.

348 {
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");
351 }
352 return mcm.mcm.mcm_parameters.maneuver_container.road_user_container;
353}

◆ 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 195 of file mcm_getters.h.

195 {
197}
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 182 of file mcm_getters.h.

182 {
183 if (!suggested_maneuver_container.suggested_maneuver_is_present) {
184 throw std::invalid_argument("No suggested maneuver present in SuggestedManeuverContainer");
185 }
186 return suggested_maneuver_container.suggested_maneuver;
187}

◆ 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 158 of file mcm_getters.h.

158 {
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");
161 }
162 return mcm.mcm.mcm_parameters.maneuver_container.suggested_maneuver_container;
163}

◆ 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 171 of file mcm_getters.h.

171 {
172 return suggested_maneuver_container.target_station_id.value;
173}

◆ 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 142 of file mcm_getters.h.

142 {
143 int zone; // unused, but required by the function signature
144 bool northp; // unused, but required by the function signature
145 double conv_angle; // unused, but required by the function signature
146 return getUTMPosition(mcm.mcm.mcm_parameters.basic_container.reference_position, zone, northp, conv_angle);
147}
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:79

◆ 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 128 of file mcm_getters.h.

128 {
129 double conv_angle; // unused, but required by the function signature
130 return getUTMPosition(mcm.mcm.mcm_parameters.basic_container.reference_position, zone, northp, conv_angle);
131}

◆ 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 113 of file mcm_getters.h.

113 {
114 return getUTMPosition(mcm.mcm.mcm_parameters.basic_container.reference_position, zone, northp, conv_angle);
115}

◆ 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 79 of file mcm_getters.h.

79 {
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);
84 try {
85 double scale;
86 GeographicLib::UTMUPS::Forward(latitude, longitude, zone, northp, utm_point.point.x, utm_point.point.y, conv_angle,
87 scale);
88 std::string hemisphere;
89 if (northp) {
90 hemisphere = "N";
91 } else {
92 hemisphere = "S";
93 }
94 utm_point.header.frame_id = "utm_" + std::to_string(zone) + hemisphere;
95 } catch (GeographicLib::GeographicErr& e) {
96 throw std::invalid_argument(e.what());
97 }
98 return utm_point;
99}
double getLatitude(const Latitude &latitude)
Get the Latitude value.
Definition mcm_getters.h:42
double getAltitude(const Altitude &altitude)
Get the Altitude value.
Definition mcm_getters.h:58
double getLongitude(const Longitude &longitude)
Get the Longitude value.
Definition mcm_getters.h:50

◆ 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 279 of file mcm_getters.h.

279 {
280 gm::Point point;
281 point.x = static_cast<double>(longitudinal_waypoint.waypoint.x_distance.value * 1e-2); // convert cm to m
282 point.y = static_cast<double>(longitudinal_waypoint.waypoint.y_distance.value * 1e-2); // convert cm to m
283 point.z = 0.0; // z-coordinate is not used in longitudinal waypoints
284 return point;
285}