etsi_its_messages v3.1.0
 
Loading...
Searching...
No Matches
cdd_v2-1-1_getters.h
Go to the documentation of this file.
1/*
2=============================================================================
3MIT License
4
5Copyright (c) 2023-2025 Institute for Automotive Engineering (ika), RWTH Aachen University
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24=============================================================================
25*/
26
31
32#ifndef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_1_1_GETTERS_H
33#define ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_1_1_GETTERS_H
34
35#include <GeographicLib/UTMUPS.hpp>
36
38
45inline double getLongitudinalAcceleration(const AccelerationComponent& longitudinal_acceleration) {
46 return ((double)longitudinal_acceleration.value.value) * 1e-1;
47}
48
55inline double getLongitudinalAccelerationConfidence(const AccelerationComponent& longitudinal_acceleration) {
56 return ((double)longitudinal_acceleration.confidence.value) * 1e-1 / etsi_its_msgs::ONE_D_GAUSSIAN_FACTOR;
57}
58
65inline double getLateralAcceleration(const AccelerationComponent& lateral_acceleration) {
66 return ((double)lateral_acceleration.value.value) * 1e-1;
67}
68
75inline double getLateralAccelerationConfidence(const AccelerationComponent& lateral_acceleration) {
76 return ((double)lateral_acceleration.confidence.value) * 1e-1 / etsi_its_msgs::ONE_D_GAUSSIAN_FACTOR;
77}
78
79
86template <typename PositionConfidenceEllipse>
87inline std::tuple<double, double, double> getPositionConfidenceEllipse(PositionConfidenceEllipse& position_confidence_ellipse) {
88 return {
89 getSemiAxis(position_confidence_ellipse.semi_major_axis_length),
90 getSemiAxis(position_confidence_ellipse.semi_minor_axis_length),
91 position_confidence_ellipse.semi_major_axis_orientation.value * 1e-1
92 };
93}
94
102template <typename PositionConfidenceEllipse>
103inline std::array<double, 4> getPositionConfidenceEllipse(const PositionConfidenceEllipse& position_confidence_ellipse, const double object_heading){
104 auto [semi_major, semi_minor, major_orientation] = getPositionConfidenceEllipse(position_confidence_ellipse);
105 return CovMatrixFromConfidenceEllipse(semi_major, semi_minor, major_orientation, object_heading);
106}
107
115template <typename PositionConfidenceEllipse>
116inline std::array<double, 4> getWGSPositionConfidenceEllipse(const PositionConfidenceEllipse& position_confidence_ellipse){
117 auto [semi_major, semi_minor, major_orientation] = getPositionConfidenceEllipse(position_confidence_ellipse);
118 return WGSCovMatrixFromConfidenceEllipse(semi_major, semi_minor, major_orientation);
119}
120
121
122#endif // ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_1_1_GETTERS_H
Common getter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1 and v2....
double getSemiAxis(const SemiAxisLength &semi_axis_length)
Get the Semi Axis object.
std::array< double, 4 > CovMatrixFromConfidenceEllipse(double semi_major, double semi_minor, double major_orientation, const double object_heading)
Convert the confidence ellipse to a covariance matrix.
std::array< double, 4 > WGSCovMatrixFromConfidenceEllipse(double semi_major, double semi_minor, double major_orientation)
Convert the confidence ellipse to a covariance matrix.
std::array< double, 4 > getWGSPositionConfidenceEllipse(const PositionConfidenceEllipse &position_confidence_ellipse)
Get the covariance matrix of the position confidence ellipse.
double getLateralAcceleration(const AccelerationComponent &lateral_acceleration)
Get the lateral acceleration.
double getLongitudinalAcceleration(const AccelerationComponent &longitudinal_acceleration)
Get the longitudinal acceleration.
double getLateralAccelerationConfidence(const AccelerationComponent &lateral_acceleration)
Get the Lateral Acceleration Confidence.
double getLongitudinalAccelerationConfidence(const AccelerationComponent &longitudinal_acceleration)
Get the Longitudinal Acceleration Confidence.
std::tuple< double, double, double > getPositionConfidenceEllipse(PositionConfidenceEllipse &position_confidence_ellipse)
Extract major axis length, minor axis length and orientation from the given position confidence ellip...