etsi_its_messages
v3.5.0
Toggle main menu visibility
Loading...
Searching...
No Matches
cam_ts_setters.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// Copyright Institute for Automotive Engineering (ika), RWTH Aachen University
3
8
9
#pragma once
10
11
namespace
etsi_its_cam_ts_msgs::access {
12
13
#include <
etsi_its_msgs_utils/impl/cdd/cdd_v2-1-1_setters.h
>
14
15
#include <
etsi_its_msgs_utils/impl/cam/cam_setters_common.h
>
16
21
* @param station_id
22
* @param protocol_version
23
*/
24
inline
void
setItsPduHeader
(CAM& cam,
const
uint32_t station_id,
const
uint8_t protocol_version = 0) {
25
setItsPduHeader
(cam.header, MessageId::CAM, station_id, protocol_version);
26
}
27
28
/**
29
* @brief Set the confidence of the reference position
30
*
31
* @param cam CAM-Message to set the confidence
32
* @param covariance_matrix The four values of the covariance matrix in the order: cov_xx, cov_xy, cov_yx, cov_yy
33
* The matrix has to be SPD, otherwise a std::invalid_argument exception is thrown.
34
* Its coordinate system is aligned with the object (x = longitudinal, y = lateral)
35
* @param object_heading heading of the object in rad, with respect to WGS84
36
*/
37
inline
void
setRefPosConfidence
(CAM& cam,
const
std::array<double, 4>& covariance_matrix,
const
double
object_heading) {
38
// First ensure, that the object has the correct heading by setting its value
39
double
orientation = object_heading * 180 / M_PI;
// Convert to degrees
40
// Normalize to [0, 360)
41
orientation = std::fmod(orientation + 360, 360);
42
while
(orientation < 0) {
43
orientation += 360;
44
}
45
while
(orientation >= 360) {
46
orientation -= 360;
47
}
48
setHeading
(cam, orientation);
49
setPositionConfidenceEllipse
(cam.cam.cam_parameters.basic_container.reference_position.position_confidence_ellipse,
50
covariance_matrix, object_heading);
51
}
52
53
/**
54
* @brief Set the confidence of the reference position
55
*
56
* @param cam CAM-Message to set the confidence
57
* @param covariance_matrix The four values of the covariance matrix in the order: cov_xx, cov_xy, cov_yx, cov_yy
58
* The matrix has to be SPD, otherwise a std::invalid_argument exception is thrown.
59
* Its coordinate system is WGS84 (x = North, y = East)
60
*/
61
inline
void
setWGSRefPosConfidence
(CAM& cam,
const
std::array<double, 4>& covariance_matrix) {
62
setWGSPositionConfidenceEllipse
(cam.cam.cam_parameters.basic_container.reference_position.position_confidence_ellipse,
63
covariance_matrix);
64
}
65
66
67
}
// namespace etsi_its_cam_ts_msgs::access
cam_setters_common.h
Common setter functions for the ETSI ITS CAM (EN and TS).
setHeading
void setHeading(CAM &cam, const double heading_val, const double confidence=std::numeric_limits< double >::infinity())
Set the Heading for a CAM.
Definition
cam_setters_common.h:66
etsi_its_cam_ts_msgs::access::setWGSRefPosConfidence
void setWGSRefPosConfidence(CAM &cam, const std::array< double, 4 > &covariance_matrix)
Set the confidence of the reference position.
Definition
cam_ts_setters.h:61
etsi_its_cam_ts_msgs::access::setWGSPositionConfidenceEllipse
void setWGSPositionConfidenceEllipse(PositionConfidenceEllipse &position_confidence_ellipse, const std::array< double, 4 > &covariance_matrix)
Set the Position Confidence Ellipse object.
Definition
cam_ts_setters.h:135
etsi_its_cam_ts_msgs::access::setRefPosConfidence
void setRefPosConfidence(CAM &cam, const std::array< double, 4 > &covariance_matrix, const double object_heading)
Set the confidence of the reference position.
Definition
cam_ts_setters.h:37
etsi_its_cam_ts_msgs::access::setItsPduHeader
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.
Definition
cam_ts_setters.h:25
cdd_v2-1-1_setters.h
Setter functions for the ETSI ITS Common Data Dictionary (CDD) v2.1.1.
setPositionConfidenceEllipse
void setPositionConfidenceEllipse(PositionConfidenceEllipse &position_confidence_ellipse, const double semi_major_axis, const double semi_minor_axis, const double orientation)
Set the Position Confidence Ellipse object.
Definition
cdd_v2-1-1_setters.h:103
etsi_its_msgs_utils
include
etsi_its_msgs_utils
impl
cam
cam_ts_setters.h
Generated by
1.17.0