Common setter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1 and v2.1.1. More...
#include <etsi_its_msgs_utils/impl/checks.h>
#include <etsi_its_msgs_utils/impl/constants.h>
#include <GeographicLib/UTMUPS.hpp>
#include <array>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <type_traits>
Go to the source code of this file.
Functions | |
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 | setLatitude (Latitude &latitude, const double deg) |
Set the Latitude object. | |
void | setLongitude (Longitude &longitude, const double deg) |
Set the Longitude object. | |
void | setAltitudeValue (AltitudeValue &altitude, const double value) |
Set the AltitudeValue object. | |
void | setAltitude (Altitude &altitude, const double value) |
Set the Altitude object. | |
void | setSpeedValue (SpeedValue &speed, const double value) |
Set the SpeedValue object. | |
void | setSpeedConfidence (SpeedConfidence &speed_confidence, const double value) |
Set the Speed Confidence object. | |
void | setSpeed (Speed &speed, const double value, const double confidence=std::numeric_limits< double >::infinity()) |
Set the Speed object. | |
template<typename AccelerationConfidence> | |
void | setAccelerationConfidence (AccelerationConfidence &accel_confidence, const double value) |
Set the Acceleration Confidence object. | |
template<typename T> | |
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. | |
template<typename T> | |
void | 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 | setHeadingValue (HeadingValue &heading, const double value) |
Set the HeadingValue object. | |
template<typename HeadingConfidence> | |
void | setHeadingConfidence (HeadingConfidence &heading_confidence, const double value) |
Set the Heading Confidence object. | |
template<typename Heading, typename HeadingConfidence = decltype(Heading::heading_confidence)> | |
void | setHeadingCDD (Heading &heading, const double value, double confidence=std::numeric_limits< double >::infinity()) |
Set the Heading object. | |
template<typename SemiAxisLength> | |
void | setSemiAxis (SemiAxisLength &semi_axis_length, const double length) |
Set the Semi Axis length. | |
template<typename PosConfidenceEllipse> | |
void | 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 > | 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 > | 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 | 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 | setWGSPosConfidenceEllipse (PosConfidenceEllipse &position_confidence_ellipse, const std::array< double, 4 > &covariance_matrix) |
Set the Pos Confidence Ellipse object. | |
Common setter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1 and v2.1.1.
Definition in file cdd_setters_common.h.
|
inline |
Gets the values needed to set a confidence ellipse from a covariance matrix.
covariance_matrix | The 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_heading | The heading of the object in rad, with respect to WGS84 |
Definition at line 319 of file cdd_setters_common.h.
|
inline |
Gets the values needed to set a confidence ellipse from a covariance matrix.
covariance_matrix | The 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_heading | The heading of the object in rad, with respect to WGS84 |
Definition at line 360 of file cdd_setters_common.h.
|
inline |
Set the Acceleration Confidence object.
accel_confidence | object to set |
value | standard deviation in m/s^2 as decimal number |
Definition at line 163 of file cdd_setters_common.h.
|
inline |
Set the Altitude object.
AltitudeConfidence is set to UNAVAILABLE
altitude | object to set |
value | Altitude value (above the reference ellipsoid surface) in meter as decimal number |
Definition at line 109 of file cdd_setters_common.h.
|
inline |
Set the AltitudeValue object.
altitude | object to set |
value | AltitudeValue value (above the reference ellipsoid surface) in meter as decimal number |
Definition at line 90 of file cdd_setters_common.h.
|
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>'
[out] | reference_position | ReferencePostion or ReferencePositionWithConfidence to set |
[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 211 of file cdd_setters_common.h.
void 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
heading | object to set |
value | Heading value in degree as decimal number |
confidence | standard deviation of heading in degree as decimal number (default: infinity, mapping to HeadingConfidence::UNAVAILABLE) |
Definition at line 270 of file cdd_setters_common.h.
|
inline |
Set the Heading Confidence object.
heading_confidence | object to set |
value | standard deviation of heading in degree as decimal number |
Definition at line 249 of file cdd_setters_common.h.
|
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
heading | object to set |
value | Heading value in degree as decimal number |
Definition at line 236 of file cdd_setters_common.h.
|
inline |
Set the Latitude object.
latitude | object to set |
deg | Latitude value in degree as decimal number |
Definition at line 66 of file cdd_setters_common.h.
|
inline |
Set the Longitude object.
longitude | object to set |
deg | Longitude value in degree as decimal number |
Definition at line 78 of file cdd_setters_common.h.
|
inline |
Set the Pos Confidence Ellipse object.
[out] | position_confidence_ellipse | The PosConfidenceEllipse to set |
[in] | semi_major_axis | length of the semi-major axis in meters |
[in] | semi_minor_axis | length of the semi-minor axis in meters |
[in] | orientation | of the semi-major axis in degrees, with respect to WGS84 |
Definition at line 303 of file cdd_setters_common.h.
|
inline |
Set the Pos Confidence Ellipse object.
position_confidence_ellipse | |
covariance_matrix | The 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_heading | The heading of the object in rad, with respect to WGS84 |
Definition at line 376 of file cdd_setters_common.h.
|
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.
ref_position | ReferencePostion or ReferencePositionWithConfidence object to set the reference position in. |
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 185 of file cdd_setters_common.h.
|
inline |
Set the Semi Axis length.
// See https://godbolt.org/z/Eceavfo99 on how the OneCentimeterHelper works with this template
semi_axis_length | The SemiAxisLength to set |
length | the desired length in meters |
Definition at line 284 of file cdd_setters_common.h.
|
inline |
Set the Speed object.
SpeedConfidence is set to UNAVAILABLE
speed | object to set |
value | Speed in in m/s as decimal number |
confidence | standard deviation in m/s as decimal number (Optional. Default is std::numeric_limits<double>::infinity(), mapping to SpeedConfidence::UNAVAILABLE) |
Definition at line 151 of file cdd_setters_common.h.
|
inline |
Set the Speed Confidence object.
speed_confidence | object to set |
value | standard deviation in m/s as decimal number |
Definition at line 132 of file cdd_setters_common.h.
|
inline |
Set the SpeedValue object.
speed | object to set |
value | SpeedValue in m/s as decimal number |
Definition at line 120 of file cdd_setters_common.h.
|
inline |
Set the TimestampITS object.
[in] | timestamp_its | TimestampITS object to set the timestamp |
[in] | unix_nanosecs | Unix-Nanoseconds to set the timestamp for |
[in] | n_leap_seconds | Number of leap-seconds since 2004. (Defaults to the todays number of leap seconds since 2004.) |
[in] | epoch_offset | Unix-Timestamp in seconds for the 01.01.2004 at 00:00:00 |
Definition at line 52 of file cdd_setters_common.h.
|
inline |
Set the Pos Confidence Ellipse object.
position_confidence_ellipse | |
covariance_matrix | The 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_heading | The heading of the object in rad, with respect to WGS84 |
Definition at line 391 of file cdd_setters_common.h.