etsi_its_messages v3.1.0
 
Loading...
Searching...
No Matches
denm_setters.h File Reference

Setter functions for the ETSI ITS DENM (EN) More...

#include <etsi_its_msgs_utils/impl/constants.h>
#include <etsi_its_msgs_utils/impl/checks.h>
#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
#include <etsi_its_msgs_utils/impl/cdd/cdd_v1-3-1_setters.h>

Go to the source code of this file.

Classes

struct  etsi_its_denm_msgs::access::etsi_its_msgs::OneCentimeterHelper< SemiAxisLength, typename >
 
struct  etsi_its_denm_msgs::access::etsi_its_msgs::OneCentimeterHelper< SemiAxisLength, std::void_t< decltype(SemiAxisLength::ONE_CENTIMETER)> >
 

Functions

template<typename T1, typename T2>
void etsi_its_denm_msgs::access::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.
 
void etsi_its_denm_msgs::access::throwIfNotPresent (const bool is_present, const std::string val_desc)
 Throws an exception if the given value is not present.
 
template<typename T>
void etsi_its_denm_msgs::access::setBitString (T &bitstring, const std::vector< bool > &bits)
 Set a Bit String by a vector of bools.
 
uint16_t etsi_its_denm_msgs::access::etsi_its_msgs::getLeapSecondInsertionsSince2004 (const uint64_t unix_seconds)
 Get the leap second insertions since 2004 for given unix seconds.
 
void etsi_its_denm_msgs::access::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 etsi_its_denm_msgs::access::setLatitude (Latitude &latitude, const double deg)
 Set the Latitude object.
 
void etsi_its_denm_msgs::access::setLongitude (Longitude &longitude, const double deg)
 Set the Longitude object.
 
void etsi_its_denm_msgs::access::setAltitudeValue (AltitudeValue &altitude, const double value)
 Set the AltitudeValue object.
 
void etsi_its_denm_msgs::access::setAltitude (Altitude &altitude, const double value)
 Set the Altitude object.
 
void etsi_its_denm_msgs::access::setSpeedValue (SpeedValue &speed, const double value)
 Set the SpeedValue object.
 
void etsi_its_denm_msgs::access::setSpeedConfidence (SpeedConfidence &speed_confidence, const double value)
 Set the Speed Confidence object.
 
void etsi_its_denm_msgs::access::setSpeed (Speed &speed, const double value, const double confidence=std::numeric_limits< double >::infinity())
 Set the Speed object.
 
template<typename AccelerationConfidence>
void etsi_its_denm_msgs::access::setAccelerationConfidence (AccelerationConfidence &accel_confidence, const double value)
 Set the Acceleration Confidence object.
 
template<typename T>
void etsi_its_denm_msgs::access::setReferencePosition (T &ref_position, const double latitude, const double longitude, const double altitude=AltitudeValue::UNAVAILABLE)
 Sets the reference position in the given ReferencePostion object.
 
template<typename T>
void etsi_its_denm_msgs::access::setFromUTMPosition (T &reference_position, const gm::PointStamped &utm_position, const int zone, const bool northp)
 Set the ReferencePosition from a given UTM-Position.
 
template<typename HeadingValue>
void etsi_its_denm_msgs::access::setHeadingValue (HeadingValue &heading, const double value)
 Set the HeadingValue object.
 
template<typename HeadingConfidence>
void etsi_its_denm_msgs::access::setHeadingConfidence (HeadingConfidence &heading_confidence, const double value)
 Set the Heading Confidence object.
 
template<typename Heading, typename HeadingConfidence = decltype(Heading::heading_confidence)>
void etsi_its_denm_msgs::access::setHeadingCDD (Heading &heading, const double value, double confidence=std::numeric_limits< double >::infinity())
 Set the Heading object.
 
template<typename SemiAxisLength>
void etsi_its_denm_msgs::access::setSemiAxis (SemiAxisLength &semi_axis_length, const double length)
 Set the Semi Axis length.
 
template<typename PosConfidenceEllipse>
void etsi_its_denm_msgs::access::setPosConfidenceEllipse (PosConfidenceEllipse &position_confidence_ellipse, const double semi_major_axis, const double semi_minor_axis, const double orientation)
 Set the Pos Confidence Ellipse object.
 
std::tuple< double, double, double > etsi_its_denm_msgs::access::confidenceEllipseFromCovMatrix (const std::array< double, 4 > &covariance_matrix, const double object_heading)
 Gets the values needed to set a confidence ellipse from a covariance matrix.
 
std::tuple< double, double, double > etsi_its_denm_msgs::access::confidenceEllipseFromWGSCovMatrix (const std::array< double, 4 > &covariance_matrix)
 Gets the values needed to set a confidence ellipse from a covariance matrix.
 
template<typename PosConfidenceEllipse>
void etsi_its_denm_msgs::access::setPosConfidenceEllipse (PosConfidenceEllipse &position_confidence_ellipse, const std::array< double, 4 > &covariance_matrix, const double object_heading)
 Set the Pos Confidence Ellipse object.
 
template<typename PosConfidenceEllipse>
void etsi_its_denm_msgs::access::setWGSPosConfidenceEllipse (PosConfidenceEllipse &position_confidence_ellipse, const std::array< double, 4 > &covariance_matrix)
 Set the Pos Confidence Ellipse object.
 
void etsi_its_denm_msgs::access::setStationId (StationID &station_id, const uint32_t id_value)
 Set the Station Id object.
 
void etsi_its_denm_msgs::access::setItsPduHeader (ItsPduHeader &header, const uint8_t message_id, const uint32_t station_id, const uint8_t protocol_version=0)
 Set the Its Pdu Header object.
 
void etsi_its_denm_msgs::access::setStationType (StationType &station_type, const uint8_t value)
 Set the Station Type.
 
void etsi_its_denm_msgs::access::setItsPduHeader (DENM &denm, const uint32_t station_id, const uint8_t protocol_version=0)
 Set the ItsPduHeader-object for a DENM.
 
void etsi_its_denm_msgs::access::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 etsi_its_denm_msgs::access::setStationType (DENM &denm, const int value)
 Set the StationType for a DENM.
 
void etsi_its_denm_msgs::access::setReferencePosition (DENM &denm, const double latitude, const double longitude, const double altitude=AltitudeValue::UNAVAILABLE)
 Set the ReferencePositionWithConfidence for a DENM.
 
void etsi_its_denm_msgs::access::setIsHeadingPresent (DENM &denm, bool presence_of_heading)
 Set the IsHeadingPresent object for DENM.
 
void etsi_its_denm_msgs::access::setHeading (DENM &denm, const double heading_val, const double confidence=std::numeric_limits< double >::infinity())
 Set the Heading for a DENM.
 
void etsi_its_denm_msgs::access::setIsSpeedPresent (DENM &denm, bool presence_of_speed)
 Set the IsSpeedPresent object for DENM.
 
void etsi_its_denm_msgs::access::setSpeed (DENM &denm, const double speed_val, const double confidence=std::numeric_limits< double >::infinity())
 Set the vehicle speed.
 
void etsi_its_denm_msgs::access::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 etsi_its_denm_msgs::access::setDrivingLaneStatus (DrivingLaneStatus &driving_lane_status, const std::vector< bool > &bits)
 Set the Driving Lane Status by a vector of bools.
 
void etsi_its_denm_msgs::access::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

Setter functions for the ETSI ITS DENM (EN)

Definition in file denm_setters.h.

Function Documentation

◆ confidenceEllipseFromCovMatrix()

std::tuple< double, double, double > etsi_its_denm_msgs::access::confidenceEllipseFromCovMatrix ( const std::array< double, 4 > & covariance_matrix,
const double object_heading )
inline

Gets the values needed to set a confidence ellipse from a covariance matrix.

Parameters
covariance_matrixThe four values of the covariance matrix in the order: cov_xx, cov_xy, cov_yx, cov_yy The matrix has to be SPD, otherwise a std::invalid_argument exception is thrown. Its coordinate system is aligned with the object (x = longitudinal, y = lateral)
object_headingThe heading of the object in rad, with respect to WGS84
Returns
std::tuple<double, double, double> semi_major_axis [m], semi_minor_axis [m], orientation [deg], with respect to WGS84

Definition at line 376 of file denm_setters.h.

◆ confidenceEllipseFromWGSCovMatrix()

std::tuple< double, double, double > etsi_its_denm_msgs::access::confidenceEllipseFromWGSCovMatrix ( const std::array< double, 4 > & covariance_matrix)
inline

Gets the values needed to set a confidence ellipse from a covariance matrix.

Parameters
covariance_matrixThe four values of the covariance matrix in the order: cov_xx, cov_xy, cov_yx, cov_yy The matrix has to be SPD, otherwise a std::invalid_argument exception is thrown. Its coordinate system is aligned with the WGS axes (x = North, y = East)
object_headingThe heading of the object in rad, with respect to WGS84
Returns
std::tuple<double, double, double> semi_major_axis [m], semi_minor_axis [m], orientation [deg], with respect to WGS84

Definition at line 417 of file denm_setters.h.

452 {
453
455#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
457
465inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
466 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
467}
468
476inline void setReferenceTime(
477 DENM& denm, const uint64_t unix_nanosecs,
478 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
479 TimestampIts t_its;
480 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
481 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
482 denm.denm.management.reference_time = t_its;
483}
484
491inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
492
504inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
505 const double altitude = AltitudeValue::UNAVAILABLE) {
506 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
507}
508
515inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
516 if (denm.denm.location_is_present) {
517 denm.denm.location.event_position_heading_is_present = presence_of_heading;
518 } else {
519 throw std::invalid_argument("LocationContainer is not present!");
520 }
521}
522
533inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
534 if (denm.denm.location_is_present) {
535 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
536 setIsHeadingPresent(denm, true);
537 } else {
538 throw std::invalid_argument("LocationContainer is not present!");
539 }
540}
541
548inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
549 if (denm.denm.location_is_present) {
550 denm.denm.location.event_speed_is_present = presence_of_speed;
551 } else {
552 throw std::invalid_argument("LocationContainer is not present!");
553 }
554}
555
563inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
564 if (denm.denm.location_is_present) {
565 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
566 setIsSpeedPresent(denm, true);
567 } else {
568 throw std::invalid_argument("LocationContainer is not present!");
569 }
570}
571
584inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
585 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
586}
587
594inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
595 setBitString(driving_lane_status, bits);
596}
597
604inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
605 setBitString(light_bar_siren_in_use, bits);
606}
607
608} // namespace etsi_its_denm_msgs::access
void setStationType(CAM &cam, const uint8_t value)
Set the StationType for a CAM.
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.
Setter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1.
Sanity-check functions etc.
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
const std::map< uint64_t, uint16_t > LEAP_SECOND_INSERTIONS_SINCE_2004
std::map that stores all leap second insertions since 2004 with the corresponding unix-date of the in...
Definition constants.h:45
void setReferencePosition(T &ref_position, const double latitude, const double longitude, const double altitude=AltitudeValue::UNAVAILABLE)
Sets the reference position in the given ReferencePostion object.
void setHeading(DENM &denm, const double heading_val, const double confidence=std::numeric_limits< double >::infinity())
Set the Heading for a DENM.
void setDrivingLaneStatus(DrivingLaneStatus &driving_lane_status, const std::vector< bool > &bits)
Set the Driving Lane Status by a vector of bools.
void setIsSpeedPresent(DENM &denm, bool presence_of_speed)
Set the IsSpeedPresent object for DENM.
void setHeadingCDD(Heading &heading, const double value, double confidence=std::numeric_limits< double >::infinity())
Set the Heading object.
void setFromUTMPosition(T &reference_position, const gm::PointStamped &utm_position, const int zone, const bool northp)
Set the ReferencePosition from a given UTM-Position.
void setIsHeadingPresent(DENM &denm, bool presence_of_heading)
Set the IsHeadingPresent object for DENM.
void setLightBarSirenInUse(LightBarSirenInUse &light_bar_siren_in_use, const std::vector< bool > &bits)
Set the Lightbar Siren In Use by a vector of bools.
void setSpeed(Speed &speed, const double value, const double confidence=std::numeric_limits< double >::infinity())
Set the Speed object.
void setBitString(T &bitstring, const std::vector< bool > &bits)
Set a Bit String by a vector of bools.
void setItsPduHeader(ItsPduHeader &header, const uint8_t message_id, const uint32_t station_id, const uint8_t protocol_version=0)
Set the Its Pdu Header object.

◆ getLeapSecondInsertionsSince2004()

uint16_t etsi_its_denm_msgs::access::etsi_its_msgs::getLeapSecondInsertionsSince2004 ( const uint64_t unix_seconds)
inline

Get the leap second insertions since 2004 for given unix seconds.

Parameters
unix_secondsthe current unix seconds for that the leap second insertions since 2004 shall be provided
Returns
uint16_t the number of leap second insertions since 2004 for unix_seconds

Definition at line 61 of file denm_access.h.

114 {
116}
Utility functions for the ETSI ITS DENM (EN)

◆ setAccelerationConfidence()

template<typename AccelerationConfidence>
void etsi_its_denm_msgs::access::setAccelerationConfidence ( AccelerationConfidence & accel_confidence,
const double value )
inline

Set the Acceleration Confidence object.

Parameters
accel_confidenceobject to set
valuestandard deviation in m/s^2 as decimal number

Definition at line 220 of file denm_setters.h.

255 {
256
258#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
260
268inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
269 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
270}
271
279inline void setReferenceTime(
280 DENM& denm, const uint64_t unix_nanosecs,
281 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
282 TimestampIts t_its;
283 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
284 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
285 denm.denm.management.reference_time = t_its;
286}
287
294inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
295
307inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
308 const double altitude = AltitudeValue::UNAVAILABLE) {
309 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
310}
311
318inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
319 if (denm.denm.location_is_present) {
320 denm.denm.location.event_position_heading_is_present = presence_of_heading;
321 } else {
322 throw std::invalid_argument("LocationContainer is not present!");
323 }
324}
325
336inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
337 if (denm.denm.location_is_present) {
338 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
339 setIsHeadingPresent(denm, true);
340 } else {
341 throw std::invalid_argument("LocationContainer is not present!");
342 }
343}
344
351inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
352 if (denm.denm.location_is_present) {
353 denm.denm.location.event_speed_is_present = presence_of_speed;
354 } else {
355 throw std::invalid_argument("LocationContainer is not present!");
356 }
357}
358
366inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
367 if (denm.denm.location_is_present) {
368 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
369 setIsSpeedPresent(denm, true);
370 } else {
371 throw std::invalid_argument("LocationContainer is not present!");
372 }
373}
374
387inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
388 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
389}
390
397inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
398 setBitString(driving_lane_status, bits);
399}
400
407inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
408 setBitString(light_bar_siren_in_use, bits);
409}
410
411} // namespace etsi_its_denm_msgs::access

◆ setAltitude()

void etsi_its_denm_msgs::access::setAltitude ( Altitude & altitude,
const double value )
inline

Set the Altitude object.

AltitudeConfidence is set to UNAVAILABLE

Parameters
altitudeobject to set
valueAltitude value (above the reference ellipsoid surface) in meter as decimal number

Definition at line 166 of file denm_setters.h.

168 {
169 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);

◆ setAltitudeValue()

void etsi_its_denm_msgs::access::setAltitudeValue ( AltitudeValue & altitude,
const double value )
inline

Set the AltitudeValue object.

Parameters
altitudeobject to set
valueAltitudeValue value (above the reference ellipsoid surface) in meter as decimal number

Definition at line 147 of file denm_setters.h.

147 {
148 if (denm.denm.location_is_present) {
149 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
150 setIsSpeedPresent(denm, true);
151 } else {
152 throw std::invalid_argument("LocationContainer is not present!");
153 }
154}
155

◆ setBitString()

template<typename T>
void etsi_its_denm_msgs::access::setBitString ( T & bitstring,
const std::vector< bool > & bits )
inline

Set a Bit String by a vector of bools.

Template Parameters
T
Parameters
bitstringBitString to set
bitsvector of bools

Definition at line 44 of file denm_setters.h.

60inline void setReferenceTime(
61 DENM& denm, const uint64_t unix_nanosecs,
62 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
63 TimestampIts t_its;
64 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
65 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
66 denm.denm.management.reference_time = t_its;
67}
68

◆ setDrivingLaneStatus()

void etsi_its_denm_msgs::access::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 244 of file denm_setters.h.

292inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
293 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
294}
295
303inline void setReferenceTime(
304 DENM& denm, const uint64_t unix_nanosecs,
305 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
306 TimestampIts t_its;
307 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
308 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
309 denm.denm.management.reference_time = t_its;
310}
311
318inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
319
331inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
332 const double altitude = AltitudeValue::UNAVAILABLE) {
333 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
334}
335
342inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
343 if (denm.denm.location_is_present) {
344 denm.denm.location.event_position_heading_is_present = presence_of_heading;
345 } else {
346 throw std::invalid_argument("LocationContainer is not present!");
347 }
348}
349
360inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
361 if (denm.denm.location_is_present) {
362 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
363 setIsHeadingPresent(denm, true);
364 } else {
365 throw std::invalid_argument("LocationContainer is not present!");
366 }
367}
368
375inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
376 if (denm.denm.location_is_present) {
377 denm.denm.location.event_speed_is_present = presence_of_speed;
378 } else {
379 throw std::invalid_argument("LocationContainer is not present!");
380 }
381}
382
390inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
391 if (denm.denm.location_is_present) {
392 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
393 setIsSpeedPresent(denm, true);
394 } else {
395 throw std::invalid_argument("LocationContainer is not present!");
396 }
397}
398
411inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
412 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
413}
414
421inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
422 setBitString(driving_lane_status, bits);
423}
424
431inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
432 setBitString(light_bar_siren_in_use, bits);
433}
434
435} // namespace etsi_its_denm_msgs::access

◆ setFromUTMPosition() [1/2]

void etsi_its_denm_msgs::access::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 234 of file denm_setters.h.

269 {
270
272#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
274
282inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
283 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
284}
285
293inline void setReferenceTime(
294 DENM& denm, const uint64_t unix_nanosecs,
295 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
296 TimestampIts t_its;
297 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
298 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
299 denm.denm.management.reference_time = t_its;
300}
301
308inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
309
321inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
322 const double altitude = AltitudeValue::UNAVAILABLE) {
323 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
324}
325
332inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
333 if (denm.denm.location_is_present) {
334 denm.denm.location.event_position_heading_is_present = presence_of_heading;
335 } else {
336 throw std::invalid_argument("LocationContainer is not present!");
337 }
338}
339
350inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
351 if (denm.denm.location_is_present) {
352 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
353 setIsHeadingPresent(denm, true);
354 } else {
355 throw std::invalid_argument("LocationContainer is not present!");
356 }
357}
358
365inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
366 if (denm.denm.location_is_present) {
367 denm.denm.location.event_speed_is_present = presence_of_speed;
368 } else {
369 throw std::invalid_argument("LocationContainer is not present!");
370 }
371}
372
380inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
381 if (denm.denm.location_is_present) {
382 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
383 setIsSpeedPresent(denm, true);
384 } else {
385 throw std::invalid_argument("LocationContainer is not present!");
386 }
387}
388
401inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
402 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
403}
404
411inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
412 setBitString(driving_lane_status, bits);
413}
414
421inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
422 setBitString(light_bar_siren_in_use, bits);
423}
424
425} // namespace etsi_its_denm_msgs::access

◆ setFromUTMPosition() [2/2]

template<typename T>
void etsi_its_denm_msgs::access::setFromUTMPosition ( T & reference_position,
const gm::PointStamped & utm_position,
const int zone,
const bool northp )
inline

Set the ReferencePosition 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]reference_positionReferencePostion or ReferencePositionWithConfidence to set
[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 268 of file denm_setters.h.

303 {
304
306#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
308
316inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
317 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
318}
319
327inline void setReferenceTime(
328 DENM& denm, const uint64_t unix_nanosecs,
329 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
330 TimestampIts t_its;
331 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
332 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
333 denm.denm.management.reference_time = t_its;
334}
335
342inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
343
355inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
356 const double altitude = AltitudeValue::UNAVAILABLE) {
357 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
358}
359
366inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
367 if (denm.denm.location_is_present) {
368 denm.denm.location.event_position_heading_is_present = presence_of_heading;
369 } else {
370 throw std::invalid_argument("LocationContainer is not present!");
371 }
372}
373
384inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
385 if (denm.denm.location_is_present) {
386 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
387 setIsHeadingPresent(denm, true);
388 } else {
389 throw std::invalid_argument("LocationContainer is not present!");
390 }
391}
392
399inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
400 if (denm.denm.location_is_present) {
401 denm.denm.location.event_speed_is_present = presence_of_speed;
402 } else {
403 throw std::invalid_argument("LocationContainer is not present!");
404 }
405}
406
414inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
415 if (denm.denm.location_is_present) {
416 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
417 setIsSpeedPresent(denm, true);
418 } else {
419 throw std::invalid_argument("LocationContainer is not present!");
420 }
421}
422
435inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
436 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
437}
438
445inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
446 setBitString(driving_lane_status, bits);
447}
448
455inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
456 setBitString(light_bar_siren_in_use, bits);
457}
458
459} // namespace etsi_its_denm_msgs::access

◆ setHeading()

void etsi_its_denm_msgs::access::setHeading ( DENM & denm,
const double heading_val,
const double confidence = std::numeric_limits<double>::infinity() )
inline

Set the Heading for a DENM.

0.0° equals WGS84 North, 90.0° equals WGS84 East, 180.0° equals WGS84 South and 270.0° equals WGS84 West HeadingConfidence is set to UNAVAILABLE

Parameters
denmDENM to set the ReferencePosition
valueHeading value in degree as decimal number
confidencestandard deviation of heading in degree as decimal number (default: infinity, mapping to HeadingConfidence::UNAVAILABLE)

Definition at line 183 of file denm_setters.h.

188 {
189 setBitString(light_bar_siren_in_use, bits);
190}

◆ setHeadingCDD()

template<typename Heading, typename HeadingConfidence = decltype(Heading::heading_confidence)>
void etsi_its_denm_msgs::access::setHeadingCDD ( Heading & heading,
const double value,
double confidence = std::numeric_limits<double>::infinity() )

Set the Heading object.

0.0° equals WGS84 North, 90.0° equals WGS84 East, 180.0° equals WGS84 South and 270.0° equals WGS84 West HeadingConfidence is set to UNAVAILABLE

Parameters
headingobject to set
valueHeading value in degree as decimal number
confidencestandard deviation of heading in degree as decimal number (default: infinity, mapping to HeadingConfidence::UNAVAILABLE)

Definition at line 327 of file denm_setters.h.

362 {
363
365#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
367
375inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
376 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
377}
378
386inline void setReferenceTime(
387 DENM& denm, const uint64_t unix_nanosecs,
388 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
389 TimestampIts t_its;
390 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
391 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
392 denm.denm.management.reference_time = t_its;
393}
394
401inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
402
414inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
415 const double altitude = AltitudeValue::UNAVAILABLE) {
416 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
417}
418
425inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
426 if (denm.denm.location_is_present) {
427 denm.denm.location.event_position_heading_is_present = presence_of_heading;
428 } else {
429 throw std::invalid_argument("LocationContainer is not present!");
430 }
431}
432
443inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
444 if (denm.denm.location_is_present) {
445 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
446 setIsHeadingPresent(denm, true);
447 } else {
448 throw std::invalid_argument("LocationContainer is not present!");
449 }
450}
451
458inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
459 if (denm.denm.location_is_present) {
460 denm.denm.location.event_speed_is_present = presence_of_speed;
461 } else {
462 throw std::invalid_argument("LocationContainer is not present!");
463 }
464}
465
473inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
474 if (denm.denm.location_is_present) {
475 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
476 setIsSpeedPresent(denm, true);
477 } else {
478 throw std::invalid_argument("LocationContainer is not present!");
479 }
480}
481
494inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
495 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
496}
497
504inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
505 setBitString(driving_lane_status, bits);
506}
507
514inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
515 setBitString(light_bar_siren_in_use, bits);
516}
517
518} // namespace etsi_its_denm_msgs::access

◆ setHeadingConfidence()

template<typename HeadingConfidence>
void etsi_its_denm_msgs::access::setHeadingConfidence ( HeadingConfidence & heading_confidence,
const double value )
inline

Set the Heading Confidence object.

Parameters
heading_confidenceobject to set
valuestandard deviation of heading in degree as decimal number

Definition at line 306 of file denm_setters.h.

341 {
342
344#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
346
354inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
355 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
356}
357
365inline void setReferenceTime(
366 DENM& denm, const uint64_t unix_nanosecs,
367 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
368 TimestampIts t_its;
369 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
370 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
371 denm.denm.management.reference_time = t_its;
372}
373
380inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
381
393inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
394 const double altitude = AltitudeValue::UNAVAILABLE) {
395 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
396}
397
404inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
405 if (denm.denm.location_is_present) {
406 denm.denm.location.event_position_heading_is_present = presence_of_heading;
407 } else {
408 throw std::invalid_argument("LocationContainer is not present!");
409 }
410}
411
422inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
423 if (denm.denm.location_is_present) {
424 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
425 setIsHeadingPresent(denm, true);
426 } else {
427 throw std::invalid_argument("LocationContainer is not present!");
428 }
429}
430
437inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
438 if (denm.denm.location_is_present) {
439 denm.denm.location.event_speed_is_present = presence_of_speed;
440 } else {
441 throw std::invalid_argument("LocationContainer is not present!");
442 }
443}
444
452inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
453 if (denm.denm.location_is_present) {
454 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
455 setIsSpeedPresent(denm, true);
456 } else {
457 throw std::invalid_argument("LocationContainer is not present!");
458 }
459}
460
473inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
474 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
475}
476
483inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
484 setBitString(driving_lane_status, bits);
485}
486
493inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
494 setBitString(light_bar_siren_in_use, bits);
495}
496
497} // namespace etsi_its_denm_msgs::access

◆ setHeadingValue()

template<typename HeadingValue>
void etsi_its_denm_msgs::access::setHeadingValue ( HeadingValue & heading,
const double value )
inline

Set the HeadingValue object.

0.0° equals WGS84 North, 90.0° equals WGS84 East, 180.0° equals WGS84 South and 270.0° equals WGS84 West

Parameters
headingobject to set
valueHeading value in degree as decimal number

Definition at line 293 of file denm_setters.h.

328 {
329
331#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
333
341inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
342 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
343}
344
352inline void setReferenceTime(
353 DENM& denm, const uint64_t unix_nanosecs,
354 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
355 TimestampIts t_its;
356 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
357 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
358 denm.denm.management.reference_time = t_its;
359}
360
367inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
368
380inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
381 const double altitude = AltitudeValue::UNAVAILABLE) {
382 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
383}
384
391inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
392 if (denm.denm.location_is_present) {
393 denm.denm.location.event_position_heading_is_present = presence_of_heading;
394 } else {
395 throw std::invalid_argument("LocationContainer is not present!");
396 }
397}
398
409inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
410 if (denm.denm.location_is_present) {
411 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
412 setIsHeadingPresent(denm, true);
413 } else {
414 throw std::invalid_argument("LocationContainer is not present!");
415 }
416}
417
424inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
425 if (denm.denm.location_is_present) {
426 denm.denm.location.event_speed_is_present = presence_of_speed;
427 } else {
428 throw std::invalid_argument("LocationContainer is not present!");
429 }
430}
431
439inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
440 if (denm.denm.location_is_present) {
441 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
442 setIsSpeedPresent(denm, true);
443 } else {
444 throw std::invalid_argument("LocationContainer is not present!");
445 }
446}
447
460inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
461 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
462}
463
470inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
471 setBitString(driving_lane_status, bits);
472}
473
480inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
481 setBitString(light_bar_siren_in_use, bits);
482}
483
484} // namespace etsi_its_denm_msgs::access

◆ setIsHeadingPresent()

void etsi_its_denm_msgs::access::setIsHeadingPresent ( DENM & denm,
bool presence_of_heading )
inline

Set the IsHeadingPresent object for DENM.

Parameters
denmDENM to set IsHeadingPresent
presence_of_headingIsHeadingPresent-Value (true or false)

Definition at line 165 of file denm_setters.h.

168 {
169 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
170}
171

◆ setIsSpeedPresent()

void etsi_its_denm_msgs::access::setIsSpeedPresent ( DENM & denm,
bool presence_of_speed )
inline

Set the IsSpeedPresent object for DENM.

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

Definition at line 198 of file denm_setters.h.

233 {
234
236#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
238
246inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
247 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
248}
249
257inline void setReferenceTime(
258 DENM& denm, const uint64_t unix_nanosecs,
259 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
260 TimestampIts t_its;
261 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
262 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
263 denm.denm.management.reference_time = t_its;
264}
265
272inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
273
285inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
286 const double altitude = AltitudeValue::UNAVAILABLE) {
287 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
288}
289
296inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
297 if (denm.denm.location_is_present) {
298 denm.denm.location.event_position_heading_is_present = presence_of_heading;
299 } else {
300 throw std::invalid_argument("LocationContainer is not present!");
301 }
302}
303
314inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
315 if (denm.denm.location_is_present) {
316 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
317 setIsHeadingPresent(denm, true);
318 } else {
319 throw std::invalid_argument("LocationContainer is not present!");
320 }
321}
322
329inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
330 if (denm.denm.location_is_present) {
331 denm.denm.location.event_speed_is_present = presence_of_speed;
332 } else {
333 throw std::invalid_argument("LocationContainer is not present!");
334 }
335}
336
344inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
345 if (denm.denm.location_is_present) {
346 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
347 setIsSpeedPresent(denm, true);
348 } else {
349 throw std::invalid_argument("LocationContainer is not present!");
350 }
351}
352
365inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
366 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
367}
368
375inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
376 setBitString(driving_lane_status, bits);
377}
378
385inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
386 setBitString(light_bar_siren_in_use, bits);
387}
388
389} // namespace etsi_its_denm_msgs::access

◆ setItsPduHeader() [1/2]

void etsi_its_denm_msgs::access::setItsPduHeader ( DENM & denm,
const uint32_t station_id,
const uint8_t protocol_version = 0 )
inline

Set the ItsPduHeader-object for a DENM.

Parameters
denmDENM-Message to set the ItsPduHeader
station_id
protocol_version

Definition at line 115 of file denm_setters.h.

115 : infinity, mapping to HeadingConfidence::UNAVAILABLE)
116 */
117inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {

◆ setItsPduHeader() [2/2]

void etsi_its_denm_msgs::access::setItsPduHeader ( ItsPduHeader & header,
const uint8_t message_id,
const uint32_t station_id,
const uint8_t protocol_version = 0 )
inline

Set the Its Pdu Header object.

Parameters
headerItsPduHeader to be set
message_idID of the message
station_id
protocol_version

Definition at line 85 of file denm_setters.h.

89 {
90 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
91}
92

◆ setLatitude()

void etsi_its_denm_msgs::access::setLatitude ( Latitude & latitude,
const double deg )
inline

Set the Latitude object.

Parameters
latitudeobject to set
degLatitude value in degree as decimal number

Definition at line 123 of file denm_setters.h.

◆ setLightBarSirenInUse()

void etsi_its_denm_msgs::access::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 254 of file denm_setters.h.

302inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
303 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
304}
305
313inline void setReferenceTime(
314 DENM& denm, const uint64_t unix_nanosecs,
315 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
316 TimestampIts t_its;
317 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
318 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
319 denm.denm.management.reference_time = t_its;
320}
321
328inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
329
341inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
342 const double altitude = AltitudeValue::UNAVAILABLE) {
343 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
344}
345
352inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
353 if (denm.denm.location_is_present) {
354 denm.denm.location.event_position_heading_is_present = presence_of_heading;
355 } else {
356 throw std::invalid_argument("LocationContainer is not present!");
357 }
358}
359
370inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
371 if (denm.denm.location_is_present) {
372 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
373 setIsHeadingPresent(denm, true);
374 } else {
375 throw std::invalid_argument("LocationContainer is not present!");
376 }
377}
378
385inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
386 if (denm.denm.location_is_present) {
387 denm.denm.location.event_speed_is_present = presence_of_speed;
388 } else {
389 throw std::invalid_argument("LocationContainer is not present!");
390 }
391}
392
400inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
401 if (denm.denm.location_is_present) {
402 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
403 setIsSpeedPresent(denm, true);
404 } else {
405 throw std::invalid_argument("LocationContainer is not present!");
406 }
407}
408
421inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
422 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
423}
424
431inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
432 setBitString(driving_lane_status, bits);
433}
434
441inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
442 setBitString(light_bar_siren_in_use, bits);
443}
444
445} // namespace etsi_its_denm_msgs::access

◆ setLongitude()

void etsi_its_denm_msgs::access::setLongitude ( Longitude & longitude,
const double deg )
inline

Set the Longitude object.

Parameters
longitudeobject to set
degLongitude value in degree as decimal number

Definition at line 135 of file denm_setters.h.

135 {
136 throw std::invalid_argument("LocationContainer is not present!");
137 }
138}
139

◆ setPosConfidenceEllipse() [1/2]

template<typename PosConfidenceEllipse>
void etsi_its_denm_msgs::access::setPosConfidenceEllipse ( PosConfidenceEllipse & position_confidence_ellipse,
const double semi_major_axis,
const double semi_minor_axis,
const double orientation )
inline

Set the Pos Confidence Ellipse object.

Parameters
[out]position_confidence_ellipseThe PosConfidenceEllipse to set
[in]semi_major_axislength of the semi-major axis in meters
[in]semi_minor_axislength of the semi-minor axis in meters
[in]orientationof the semi-major axis in degrees, with respect to WGS84

Definition at line 360 of file denm_setters.h.

395 {
396
398#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
400
408inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
409 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
410}
411
419inline void setReferenceTime(
420 DENM& denm, const uint64_t unix_nanosecs,
421 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
422 TimestampIts t_its;
423 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
424 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
425 denm.denm.management.reference_time = t_its;
426}
427
434inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
435
447inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
448 const double altitude = AltitudeValue::UNAVAILABLE) {
449 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
450}
451
458inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
459 if (denm.denm.location_is_present) {
460 denm.denm.location.event_position_heading_is_present = presence_of_heading;
461 } else {
462 throw std::invalid_argument("LocationContainer is not present!");
463 }
464}
465
476inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
477 if (denm.denm.location_is_present) {
478 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
479 setIsHeadingPresent(denm, true);
480 } else {
481 throw std::invalid_argument("LocationContainer is not present!");
482 }
483}
484
491inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
492 if (denm.denm.location_is_present) {
493 denm.denm.location.event_speed_is_present = presence_of_speed;
494 } else {
495 throw std::invalid_argument("LocationContainer is not present!");
496 }
497}
498
506inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
507 if (denm.denm.location_is_present) {
508 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
509 setIsSpeedPresent(denm, true);
510 } else {
511 throw std::invalid_argument("LocationContainer is not present!");
512 }
513}
514
527inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
528 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
529}
530
537inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
538 setBitString(driving_lane_status, bits);
539}
540
547inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
548 setBitString(light_bar_siren_in_use, bits);
549}
550
551} // namespace etsi_its_denm_msgs::access

◆ setPosConfidenceEllipse() [2/2]

template<typename PosConfidenceEllipse>
void etsi_its_denm_msgs::access::setPosConfidenceEllipse ( PosConfidenceEllipse & position_confidence_ellipse,
const std::array< double, 4 > & covariance_matrix,
const double object_heading )
inline

Set the Pos Confidence Ellipse object.

Parameters
position_confidence_ellipse
covariance_matrixThe four values of the covariance matrix in the order: cov_xx, cov_xy, cov_yx, cov_yy The matrix has to be SPD, otherwise a std::invalid_argument exception is thrown. Its coordinate system is aligned with the object (x = longitudinal, y = lateral)
object_headingThe heading of the object in rad, with respect to WGS84

Definition at line 433 of file denm_setters.h.

468 {
469
471#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
473
481inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
482 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
483}
484
492inline void setReferenceTime(
493 DENM& denm, const uint64_t unix_nanosecs,
494 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
495 TimestampIts t_its;
496 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
497 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
498 denm.denm.management.reference_time = t_its;
499}
500
507inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
508
520inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
521 const double altitude = AltitudeValue::UNAVAILABLE) {
522 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
523}
524
531inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
532 if (denm.denm.location_is_present) {
533 denm.denm.location.event_position_heading_is_present = presence_of_heading;
534 } else {
535 throw std::invalid_argument("LocationContainer is not present!");
536 }
537}
538
549inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
550 if (denm.denm.location_is_present) {
551 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
552 setIsHeadingPresent(denm, true);
553 } else {
554 throw std::invalid_argument("LocationContainer is not present!");
555 }
556}
557
564inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
565 if (denm.denm.location_is_present) {
566 denm.denm.location.event_speed_is_present = presence_of_speed;
567 } else {
568 throw std::invalid_argument("LocationContainer is not present!");
569 }
570}
571
579inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
580 if (denm.denm.location_is_present) {
581 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
582 setIsSpeedPresent(denm, true);
583 } else {
584 throw std::invalid_argument("LocationContainer is not present!");
585 }
586}
587
600inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
601 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
602}
603
610inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
611 setBitString(driving_lane_status, bits);
612}
613
620inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
621 setBitString(light_bar_siren_in_use, bits);
622}
623
624} // namespace etsi_its_denm_msgs::access

◆ setReferencePosition() [1/2]

void etsi_its_denm_msgs::access::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 154 of file denm_setters.h.

◆ setReferencePosition() [2/2]

template<typename T>
void etsi_its_denm_msgs::access::setReferencePosition ( T & ref_position,
const double latitude,
const double longitude,
const double altitude = AltitudeValue::UNAVAILABLE )
inline

Sets the reference position in the given ReferencePostion object.

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

Parameters
ref_positionReferencePostion or ReferencePositionWithConfidence object to set the reference position in.
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 242 of file denm_setters.h.

277 {
278
280#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
282
290inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
291 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
292}
293
301inline void setReferenceTime(
302 DENM& denm, const uint64_t unix_nanosecs,
303 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
304 TimestampIts t_its;
305 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
306 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
307 denm.denm.management.reference_time = t_its;
308}
309
316inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
317
329inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
330 const double altitude = AltitudeValue::UNAVAILABLE) {
331 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
332}
333
340inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
341 if (denm.denm.location_is_present) {
342 denm.denm.location.event_position_heading_is_present = presence_of_heading;
343 } else {
344 throw std::invalid_argument("LocationContainer is not present!");
345 }
346}
347
358inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
359 if (denm.denm.location_is_present) {
360 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
361 setIsHeadingPresent(denm, true);
362 } else {
363 throw std::invalid_argument("LocationContainer is not present!");
364 }
365}
366
373inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
374 if (denm.denm.location_is_present) {
375 denm.denm.location.event_speed_is_present = presence_of_speed;
376 } else {
377 throw std::invalid_argument("LocationContainer is not present!");
378 }
379}
380
388inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
389 if (denm.denm.location_is_present) {
390 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
391 setIsSpeedPresent(denm, true);
392 } else {
393 throw std::invalid_argument("LocationContainer is not present!");
394 }
395}
396
409inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
410 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
411}
412
419inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
420 setBitString(driving_lane_status, bits);
421}
422
429inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
430 setBitString(light_bar_siren_in_use, bits);
431}
432
433} // namespace etsi_its_denm_msgs::access

◆ setReferenceTime()

void etsi_its_denm_msgs::access::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 126 of file denm_setters.h.

132 {
133 if (denm.denm.location_is_present) {

◆ setSemiAxis()

template<typename SemiAxisLength>
void etsi_its_denm_msgs::access::setSemiAxis ( SemiAxisLength & semi_axis_length,
const double length )
inline

Set the Semi Axis length.

// See https://godbolt.org/z/Eceavfo99 on how the OneCentimeterHelper works with this template

Parameters
semi_axis_lengthThe SemiAxisLength to set
lengththe desired length in meters

Definition at line 341 of file denm_setters.h.

376 {
377
379#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
381
389inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
390 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
391}
392
400inline void setReferenceTime(
401 DENM& denm, const uint64_t unix_nanosecs,
402 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
403 TimestampIts t_its;
404 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
405 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
406 denm.denm.management.reference_time = t_its;
407}
408
415inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
416
428inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
429 const double altitude = AltitudeValue::UNAVAILABLE) {
430 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
431}
432
439inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
440 if (denm.denm.location_is_present) {
441 denm.denm.location.event_position_heading_is_present = presence_of_heading;
442 } else {
443 throw std::invalid_argument("LocationContainer is not present!");
444 }
445}
446
457inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
458 if (denm.denm.location_is_present) {
459 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
460 setIsHeadingPresent(denm, true);
461 } else {
462 throw std::invalid_argument("LocationContainer is not present!");
463 }
464}
465
472inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
473 if (denm.denm.location_is_present) {
474 denm.denm.location.event_speed_is_present = presence_of_speed;
475 } else {
476 throw std::invalid_argument("LocationContainer is not present!");
477 }
478}
479
487inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
488 if (denm.denm.location_is_present) {
489 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
490 setIsSpeedPresent(denm, true);
491 } else {
492 throw std::invalid_argument("LocationContainer is not present!");
493 }
494}
495
508inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
509 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
510}
511
518inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
519 setBitString(driving_lane_status, bits);
520}
521
528inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
529 setBitString(light_bar_siren_in_use, bits);
530}
531
532} // namespace etsi_its_denm_msgs::access

◆ setSpeed() [1/2]

void etsi_its_denm_msgs::access::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 213 of file denm_setters.h.

248 {
249
251#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
253
261inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
262 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
263}
264
272inline void setReferenceTime(
273 DENM& denm, const uint64_t unix_nanosecs,
274 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
275 TimestampIts t_its;
276 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
277 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
278 denm.denm.management.reference_time = t_its;
279}
280
287inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
288
300inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
301 const double altitude = AltitudeValue::UNAVAILABLE) {
302 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
303}
304
311inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
312 if (denm.denm.location_is_present) {
313 denm.denm.location.event_position_heading_is_present = presence_of_heading;
314 } else {
315 throw std::invalid_argument("LocationContainer is not present!");
316 }
317}
318
329inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
330 if (denm.denm.location_is_present) {
331 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
332 setIsHeadingPresent(denm, true);
333 } else {
334 throw std::invalid_argument("LocationContainer is not present!");
335 }
336}
337
344inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
345 if (denm.denm.location_is_present) {
346 denm.denm.location.event_speed_is_present = presence_of_speed;
347 } else {
348 throw std::invalid_argument("LocationContainer is not present!");
349 }
350}
351
359inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
360 if (denm.denm.location_is_present) {
361 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
362 setIsSpeedPresent(denm, true);
363 } else {
364 throw std::invalid_argument("LocationContainer is not present!");
365 }
366}
367
380inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
381 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
382}
383
390inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
391 setBitString(driving_lane_status, bits);
392}
393
400inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
401 setBitString(light_bar_siren_in_use, bits);
402}
403
404} // namespace etsi_its_denm_msgs::access

◆ setSpeed() [2/2]

void etsi_its_denm_msgs::access::setSpeed ( Speed & speed,
const double value,
const double confidence = std::numeric_limits<double>::infinity() )
inline

Set the Speed object.

SpeedConfidence is set to UNAVAILABLE

Parameters
speedobject to set
valueSpeed in in m/s as decimal number
confidencestandard deviation in m/s as decimal number (Optional. Default is std::numeric_limits<double>::infinity(), mapping to SpeedConfidence::UNAVAILABLE)

Definition at line 208 of file denm_setters.h.

243 {
244
246#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
248
256inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
257 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
258}
259
267inline void setReferenceTime(
268 DENM& denm, const uint64_t unix_nanosecs,
269 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
270 TimestampIts t_its;
271 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
272 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
273 denm.denm.management.reference_time = t_its;
274}
275
282inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
283
295inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
296 const double altitude = AltitudeValue::UNAVAILABLE) {
297 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
298}
299
306inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
307 if (denm.denm.location_is_present) {
308 denm.denm.location.event_position_heading_is_present = presence_of_heading;
309 } else {
310 throw std::invalid_argument("LocationContainer is not present!");
311 }
312}
313
324inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
325 if (denm.denm.location_is_present) {
326 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
327 setIsHeadingPresent(denm, true);
328 } else {
329 throw std::invalid_argument("LocationContainer is not present!");
330 }
331}
332
339inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
340 if (denm.denm.location_is_present) {
341 denm.denm.location.event_speed_is_present = presence_of_speed;
342 } else {
343 throw std::invalid_argument("LocationContainer is not present!");
344 }
345}
346
354inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
355 if (denm.denm.location_is_present) {
356 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
357 setIsSpeedPresent(denm, true);
358 } else {
359 throw std::invalid_argument("LocationContainer is not present!");
360 }
361}
362
375inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
376 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
377}
378
385inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
386 setBitString(driving_lane_status, bits);
387}
388
395inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
396 setBitString(light_bar_siren_in_use, bits);
397}
398
399} // namespace etsi_its_denm_msgs::access

◆ setSpeedConfidence()

void etsi_its_denm_msgs::access::setSpeedConfidence ( SpeedConfidence & speed_confidence,
const double value )
inline

Set the Speed Confidence object.

Parameters
speed_confidenceobject to set
valuestandard deviation in m/s as decimal number

Definition at line 189 of file denm_setters.h.

◆ setSpeedValue()

void etsi_its_denm_msgs::access::setSpeedValue ( SpeedValue & speed,
const double value )
inline

Set the SpeedValue object.

Parameters
speedobject to set
valueSpeedValue in m/s as decimal number

Definition at line 177 of file denm_setters.h.

178 {
179 setBitString(driving_lane_status, bits);
180}
181

◆ setStationId()

void etsi_its_denm_msgs::access::setStationId ( StationID & station_id,
const uint32_t id_value )
inline

Set the Station Id object.

Parameters
station_id
id_value

Definition at line 72 of file denm_setters.h.

75 { setStationType(denm.denm.management.station_type, value); }
void setStationType(StationType &station_type, const uint8_t value)
Set the Station Type.

◆ setStationType() [1/2]

void etsi_its_denm_msgs::access::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 141 of file denm_setters.h.

◆ setStationType() [2/2]

void etsi_its_denm_msgs::access::setStationType ( StationType & station_type,
const uint8_t value )
inline

Set the Station Type.

Parameters
station_type
value

Definition at line 101 of file denm_setters.h.

102 {
103 throw std::invalid_argument("LocationContainer is not present!");
104 }

◆ setTimestampITS()

void etsi_its_denm_msgs::access::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 )
inline

Set the TimestampITS object.

Parameters
[in]timestamp_itsTimestampITS object to set the timestamp
[in]unix_nanosecsUnix-Nanoseconds to set the timestamp for
[in]n_leap_secondsNumber of leap-seconds since 2004. (Defaults to the todays number of leap seconds since 2004.)
[in]epoch_offsetUnix-Timestamp in seconds for the 01.01.2004 at 00:00:00

Definition at line 109 of file denm_setters.h.

115 : infinity, mapping to HeadingConfidence::UNAVAILABLE)

◆ setWGSPosConfidenceEllipse()

template<typename PosConfidenceEllipse>
void etsi_its_denm_msgs::access::setWGSPosConfidenceEllipse ( PosConfidenceEllipse & position_confidence_ellipse,
const std::array< double, 4 > & covariance_matrix )
inline

Set the Pos Confidence Ellipse object.

Parameters
position_confidence_ellipse
covariance_matrixThe four values of the covariance matrix in the order: cov_xx, cov_xy, cov_yx, cov_yy The matrix has to be SPD, otherwise a std::invalid_argument exception is thrown. Its coordinate system is aligned with the WGS axes (x = North, y = East)
object_headingThe heading of the object in rad, with respect to WGS84

Definition at line 448 of file denm_setters.h.

483 {
484
486#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
488
496inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
497 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
498}
499
507inline void setReferenceTime(
508 DENM& denm, const uint64_t unix_nanosecs,
509 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin()->second) {
510 TimestampIts t_its;
511 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
512 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
513 denm.denm.management.reference_time = t_its;
514}
515
522inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
523
535inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
536 const double altitude = AltitudeValue::UNAVAILABLE) {
537 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
538}
539
546inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
547 if (denm.denm.location_is_present) {
548 denm.denm.location.event_position_heading_is_present = presence_of_heading;
549 } else {
550 throw std::invalid_argument("LocationContainer is not present!");
551 }
552}
553
564inline void setHeading(DENM& denm, const double heading_val, const double confidence = std::numeric_limits<double>::infinity()) {
565 if (denm.denm.location_is_present) {
566 setHeadingCDD(denm.denm.location.event_position_heading, heading_val, confidence);
567 setIsHeadingPresent(denm, true);
568 } else {
569 throw std::invalid_argument("LocationContainer is not present!");
570 }
571}
572
579inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
580 if (denm.denm.location_is_present) {
581 denm.denm.location.event_speed_is_present = presence_of_speed;
582 } else {
583 throw std::invalid_argument("LocationContainer is not present!");
584 }
585}
586
594inline void setSpeed(DENM& denm, const double speed_val, const double confidence = std::numeric_limits<double>::infinity()) {
595 if (denm.denm.location_is_present) {
596 setSpeed(denm.denm.location.event_speed, speed_val, confidence);
597 setIsSpeedPresent(denm, true);
598 } else {
599 throw std::invalid_argument("LocationContainer is not present!");
600 }
601}
602
615inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
616 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
617}
618
625inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
626 setBitString(driving_lane_status, bits);
627}
628
635inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
636 setBitString(light_bar_siren_in_use, bits);
637}
638
639} // namespace etsi_its_denm_msgs::access

◆ throwIfNotPresent()

void etsi_its_denm_msgs::access::throwIfNotPresent ( const bool is_present,
const std::string val_desc )
inline

Throws an exception if the given value is not present.

Parameters
is_presentWhether the value is present.
val_descDescription of the value for the exception message.

Definition at line 58 of file denm_setters.h.

◆ throwIfOutOfRange()

template<typename T1, typename T2>
void etsi_its_denm_msgs::access::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.

Template Parameters
T1
T2
Parameters
valThe value to check if it is in the range.
minThe minimum value of the range.
maxThe maximum value of the range.
val_descDescription of the value for the exception message.

Definition at line 47 of file denm_setters.h.

49 {
50 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
51}