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.
|
| 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.
|
Common setter functions for the ETSI ITS DENM (EN and TS).
Definition in file denm_setters_common.h.
◆ setDrivingLaneStatus()
| void setDrivingLaneStatus |
( |
DrivingLaneStatus & | driving_lane_status, |
|
|
const std::vector< bool > & | bits ) |
|
inline |
Set the Driving Lane Status by a vector of bools.
- Parameters
-
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] | denm | DENM for which to set the ReferencePosition |
| [in] | utm_position | geometry_msgs::PointStamped describing the given utm position |
| [in] | zone | the UTM zone (zero means UPS) of the given position |
| [in] | northp | hemisphere (true means north, false means south) |
Definition at line 121 of file denm_setters_common.h.
121 {
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
-
| denm | DENM to set IsSpeedPresent |
| presence_of_speed | IsSpeedPresent-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
-
| denm | DENM to set the ReferencePosition |
| latitude | The latitude value position in degree as decimal number. |
| longitude | The longitude value in degree as decimal number. |
| altitude | The altitude value (above the reference ellipsoid surface) in meter as decimal number (optional). |
Definition at line 74 of file denm_setters_common.h.
75 {
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
-
| denm | DENM to set the ReferenceTime-Value for |
| unix_nanosecs | Timestamp in unix-nanoseconds to set the ReferenceTime-Value from |
| n_leap_seconds | Number 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;
51 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX,
"TimestampIts");
52 denm.denm.management.reference_time = t_its;
53}
void setTimestampITS(TimestampIts ×tamp_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.
◆ setSpeed()
| void setSpeed |
( |
DENM & | denm, |
|
|
const double | speed_val, |
|
|
const double | confidence = std::numeric_limits<double>::infinity() ) |
|
inline |
Set the vehicle speed.
- Parameters
-
| denm | DENM to set the speed value |
| speed_val | speed value to set in m/s as decimal number |
| confidence | speed 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);
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
-
| denm | DENM-Message to set the station_type value |
| value | station_type value to set |
Definition at line 61 of file denm_setters_common.h.
void setStationType(DENM &denm, const int value)
Set the StationType for a DENM.