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

Common setter functions for the ETSI ITS DENM (EN and TS). More...

#include <etsi_its_msgs_utils/impl/checks.h>
#include <etsi_its_msgs_utils/impl/constants.h>
#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>

Go to the source code of this file.

Functions

void setReferenceTime (DENM &denm, const uint64_t unix_nanosecs, const uint16_t n_leap_seconds=etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin() ->second)
 Set the ReferenceTime-value.
void setStationType (DENM &denm, const int value)
 Set the StationType for a DENM.
void setReferencePosition (DENM &denm, const double latitude, const double longitude, const double altitude=AltitudeValue::UNAVAILABLE)
 Set the ReferencePositionWithConfidence for a DENM.
void setIsSpeedPresent (DENM &denm, bool presence_of_speed)
 Set the IsSpeedPresent object for DENM.
void setSpeed (DENM &denm, const double speed_val, const double confidence=std::numeric_limits< double >::infinity())
 Set the vehicle speed.
void setFromUTMPosition (DENM &denm, const gm::PointStamped &utm_position, const int &zone, const bool &northp)
 Set the ReferencePosition of a DENM from a given UTM-Position.
void setDrivingLaneStatus (DrivingLaneStatus &driving_lane_status, const std::vector< bool > &bits)
 Set the Driving Lane Status by a vector of bools.
void setLightBarSirenInUse (LightBarSirenInUse &light_bar_siren_in_use, const std::vector< bool > &bits)
 Set the Lightbar Siren In Use by a vector of bools.

Detailed Description

Common setter functions for the ETSI ITS DENM (EN and TS).

Definition in file denm_setters_common.h.

Function Documentation

◆ setDrivingLaneStatus()

void setDrivingLaneStatus ( DrivingLaneStatus & driving_lane_status,
const std::vector< bool > & bits )
inline

Set the Driving Lane Status by a vector of bools.

Parameters
driving_lane_status
bits

Definition at line 131 of file denm_setters_common.h.

131 {
132 setBitString(driving_lane_status, bits);
133}

◆ setFromUTMPosition()

void setFromUTMPosition ( DENM & denm,
const gm::PointStamped & utm_position,
const int & zone,
const bool & northp )
inline

Set the ReferencePosition of a DENM from a given UTM-Position.

The position is transformed to latitude and longitude by using GeographicLib::UTMUPS The z-Coordinate is directly used as altitude value The frame_id of the given utm_position must be set to 'utm_<zone><N/S>'

Parameters
[out]denmDENM for which to set the ReferencePosition
[in]utm_positiongeometry_msgs::PointStamped describing the given utm position
[in]zonethe UTM zone (zero means UPS) of the given position
[in]northphemisphere (true means north, false means south)

Definition at line 121 of file denm_setters_common.h.

121 {
122 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
123}
void setFromUTMPosition(DENM &denm, const gm::PointStamped &utm_position, const int &zone, const bool &northp)
Set the ReferencePosition of a DENM from a given UTM-Position.

◆ setIsSpeedPresent()

void setIsSpeedPresent ( DENM & denm,
bool presence_of_speed )
inline

Set the IsSpeedPresent object for DENM.

Parameters
denmDENM to set IsSpeedPresent
presence_of_speedIsSpeedPresent-Value (true or false)

Definition at line 85 of file denm_setters_common.h.

85 {
86 if (denm.denm.location_is_present) {
87 denm.denm.location.event_speed_is_present = presence_of_speed;
88 } else {
89 throw std::invalid_argument("LocationContainer is not present!");
90 }
91}

◆ setLightBarSirenInUse()

void setLightBarSirenInUse ( LightBarSirenInUse & light_bar_siren_in_use,
const std::vector< bool > & bits )
inline

Set the Lightbar Siren In Use by a vector of bools.

Parameters
light_bar_siren_in_use
bits

Definition at line 141 of file denm_setters_common.h.

141 {
142 setBitString(light_bar_siren_in_use, bits);
143}

◆ setReferencePosition()

void setReferencePosition ( DENM & denm,
const double latitude,
const double longitude,
const double altitude = AltitudeValue::UNAVAILABLE )
inline

Set the ReferencePositionWithConfidence for a DENM.

This function sets the latitude, longitude, and altitude of the DENMs reference position. If the altitude is not provided, it is set to AltitudeValue::UNAVAILABLE.

Parameters
denmDENM to set the ReferencePosition
latitudeThe latitude value position in degree as decimal number.
longitudeThe longitude value in degree as decimal number.
altitudeThe altitude value (above the reference ellipsoid surface) in meter as decimal number (optional).

Definition at line 74 of file denm_setters_common.h.

75 {
76 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
77}
void setReferencePosition(DENM &denm, const double latitude, const double longitude, const double altitude=AltitudeValue::UNAVAILABLE)
Set the ReferencePositionWithConfidence for a DENM.

◆ setReferenceTime()

void setReferenceTime ( DENM & denm,
const uint64_t unix_nanosecs,
const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second )
inline

Set the ReferenceTime-value.

Parameters
denmDENM to set the ReferenceTime-Value for
unix_nanosecsTimestamp in unix-nanoseconds to set the ReferenceTime-Value from
n_leap_secondsNumber of leap seconds since 2004 for the given timestamp (Defaults to the todays number of leap seconds since 2004.)

Definition at line 46 of file denm_setters_common.h.

48 {
49 TimestampIts t_its;
50 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
51 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
52 denm.denm.management.reference_time = t_its;
53}
void setTimestampITS(TimestampIts &timestamp_its, const uint64_t unix_nanosecs, const uint16_t n_leap_seconds=etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin() ->second)
Set the TimestampITS object.
void throwIfOutOfRange(const T1 &val, const T2 &min, const T2 &max, const std::string val_desc)
Throws an exception if a given value is out of a defined range.
Definition checks.h:46

◆ setSpeed()

void setSpeed ( DENM & denm,
const double speed_val,
const double confidence = std::numeric_limits<double>::infinity() )
inline

Set the vehicle speed.

Parameters
denmDENM to set the speed value
speed_valspeed value to set in m/s as decimal number
confidencespeed confidence value to set in m/s (default: infinity, mapping to SpeedConfidence::UNAVAILABLE)

Definition at line 100 of file denm_setters_common.h.

100 {
101 if (denm.denm.location_is_present) {
102 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
103 setIsSpeedPresent(denm, true);
104 } else {
105 throw std::invalid_argument("LocationContainer is not present!");
106 }
107}
void setSpeed(DENM &denm, const double speed_val, const double confidence=std::numeric_limits< double >::infinity())
Set the vehicle speed.
void setIsSpeedPresent(DENM &denm, bool presence_of_speed)
Set the IsSpeedPresent object for DENM.

◆ setStationType()

void setStationType ( DENM & denm,
const int value )
inline

Set the StationType for a DENM.

Parameters
denmDENM-Message to set the station_type value
valuestation_type value to set

Definition at line 61 of file denm_setters_common.h.

61{ setStationType(denm.denm.management.station_type, value); }
void setStationType(DENM &denm, const int value)
Set the StationType for a DENM.