etsi_its_messages v3.0.0
 
Loading...
Searching...
No Matches
cpm_ts_setters.h
Go to the documentation of this file.
1/*
2=============================================================================
3MIT License
4
5Copyright (c) 2023-2024 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#pragma once
33
36
37namespace etsi_its_cpm_ts_msgs::access {
38
40
47 * @param station_id The station ID to set in the ITS PDU header.
48 * @param protocol_version The protocol version to set in the ITS PDU header. Default is 0.
49 */
50inline void setItsPduHeader(CollectivePerceptionMessage& cpm, const uint32_t station_id,
51 const uint8_t protocol_version = 0) {
52 setItsPduHeader(cpm.header, MessageId::CPM, station_id, protocol_version);
53}
54
58 * This function sets the reference time in a CPM object. The reference time is represented
59 * by a Unix timestamp in nanoseconds including the number of leap seconds.
60 * The reference time is stored in the payload management container of the CPM.
61 *
62 * @param cpm The CPM object to set the reference time in.
63 * @param unix_nanosecs The Unix timestamp in nanoseconds representing the reference time.
64 * @param n_leap_seconds The number of leap seconds to be considered. Defaults to the todays number of leap seconds since 2004.
65 */
66inline void setReferenceTime(
67 CollectivePerceptionMessage& cpm, const uint64_t unix_nanosecs,
68 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end()->second) {
69 TimestampIts t_its;
70 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
71 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
72 cpm.payload.management_container.reference_time = t_its;
73}
74
76
83 * @param longitude The longitude value in degree as decimal number.
84 * @param altitude The altitude value (above the reference ellipsoid surface) in meter as decimal number (optional).
85 */
86inline void setReferencePosition(CollectivePerceptionMessage& cpm, const double latitude, const double longitude,
87 const double altitude = AltitudeValue::UNAVAILABLE) {
88 setReferencePosition(cpm.payload.management_container.reference_position, latitude, longitude, altitude);
89}
90
93
97 *
98 * @param[out] cpm CPM for which to set the ReferencePosition
99 * @param[in] utm_position geometry_msgs::PointStamped describing the given utm position in meters
100 * @param[in] zone the UTM zone (zero means UPS) of the given position
101 * @param[in] northp hemisphere (true means north, false means south)
102 */
103inline void setFromUTMPosition(CollectivePerceptionMessage& cpm, const gm::PointStamped& utm_position, const int& zone,
104 const bool& northp) {
105 setFromUTMPosition(cpm.payload.management_container.reference_position, utm_position, zone, northp);
106}
107
109 * @brief Set the ID of a PerceivedObject
110 *
111 * Sets the object_id of the PerceivedObject to the given ID.
112 *
113 * @param object PerceivedObject to set the ID for
114 * @param id ID to set
115 */
116inline void setIdOfPerceivedObject(PerceivedObject& object, const uint16_t id) {
117 object.object_id.value = id;
118 object.object_id_is_present = true;
119}
120
121
121/**
122 * @brief Sets the measurement delta time of a PerceivedObject.
123 *
124 * This function sets the measurement delta time of a PerceivedObject.
125 * The measurement delta time represents the time difference
126 * between the reference time of the CPM and the measurement of the object.
127 *
128 * @param object The PerceivedObject to set the measurement delta time for.
129 * @param delta_time The measurement delta time to set in milliseconds. Default value is 0.
130 * @throws std::invalid_argument if the delta_time is out of range.
131 */
132inline void setMeasurementDeltaTimeOfPerceivedObject(PerceivedObject& object, const int16_t delta_time = 0) {
133 if (delta_time < DeltaTimeMilliSecondSigned::MIN || delta_time > DeltaTimeMilliSecondSigned::MAX) {
134 throw std::invalid_argument("MeasurementDeltaTime out of range");
135 } else {
136 object.measurement_delta_time.value = delta_time;
137 }
138}
139
140/**
141 * @brief Sets the value and confidence of a CartesianCoordinateWithConfidence object.
142 *
143 * This function sets the value and confidence of a CartesianCoordinateWithConfidence object.
144 * The value is limited to the range defined by CartesianCoordinateLarge::NEGATIVE_OUT_OF_RANGE
145 * and CartesianCoordinateLarge::POSITIVE_OUT_OF_RANGE. The confidence is limited to the range
146 * defined by CoordinateConfidence::MIN and CoordinateConfidence::MAX. If the provided confidence
147 * is out of range, the confidence value is set to CoordinateConfidence::OUT_OF_RANGE.
148 *
149 * @param coordinate The CartesianCoordinateWithConfidence object to be modified.
150 * @param value The value to be set in centimeters.
151 * @param confidence The confidence to be set in centimeters (default: CoordinateConfidence::UNAVAILABLE).
152 */
153inline void setCartesianCoordinateWithConfidence(CartesianCoordinateWithConfidence& coordinate, const int32_t value,
154 const uint16_t confidence = CoordinateConfidence::UNAVAILABLE) {
155 // limit value range
156 if (value < CartesianCoordinateLarge::NEGATIVE_OUT_OF_RANGE) {
157 coordinate.value.value = CartesianCoordinateLarge::NEGATIVE_OUT_OF_RANGE;
158 } else if (value > CartesianCoordinateLarge::POSITIVE_OUT_OF_RANGE) {
159 coordinate.value.value = CartesianCoordinateLarge::POSITIVE_OUT_OF_RANGE;
160 } else {
161 coordinate.value.value = value;
162 }
163
164 // limit confidence range
165 if (confidence > CoordinateConfidence::MAX || confidence < CoordinateConfidence::MIN) {
166 coordinate.confidence.value = CoordinateConfidence::OUT_OF_RANGE;
167 } else {
168 coordinate.confidence.value = confidence;
169 }
170}
171
177 * @param object The PerceivedObject to set the position for.
178 * @param point The gm::Point representing the coordinates of the object in meters.
179 * @param x_confidence The confidence value in meters for the x-coordinate (default: CoordinateConfidence::UNAVAILABLE).
180 * @param y_confidence The confidence value in meters for the y-coordinate (default: CoordinateConfidence::UNAVAILABLE).
181 * @param z_confidence The confidence value in meters for the z-coordinate (default: CoordinateConfidence::UNAVAILABLE).
182 */
183inline void setPositionOfPerceivedObject(PerceivedObject& object, const gm::Point& point,
184 const uint16_t x_confidence = CoordinateConfidence::UNAVAILABLE,
185 const uint16_t y_confidence = CoordinateConfidence::UNAVAILABLE,
186 const uint16_t z_confidence = CoordinateConfidence::UNAVAILABLE) {
187 setCartesianCoordinateWithConfidence(object.position.x_coordinate, point.x * 100, x_confidence * 100);
188 setCartesianCoordinateWithConfidence(object.position.y_coordinate, point.y * 100, y_confidence * 100);
189 if (point.z != 0.0) {
190 setCartesianCoordinateWithConfidence(object.position.z_coordinate, point.z * 100, z_confidence * 100);
191 object.position.z_coordinate_is_present = true;
193}
194
200
208 * @throws std::invalid_argument if the UTM-Position frame_id does not match the reference position frame_id.
209 */
210inline void setUTMPositionOfPerceivedObject(CollectivePerceptionMessage& cpm, PerceivedObject& object,
211 const gm::PointStamped& utm_position,
212 const uint16_t x_confidence = CoordinateConfidence::UNAVAILABLE,
213 const uint16_t y_confidence = CoordinateConfidence::UNAVAILABLE,
214 const uint16_t z_confidence = CoordinateConfidence::UNAVAILABLE) {
215 gm::PointStamped reference_position = getUTMPosition(cpm);
216 if (utm_position.header.frame_id != reference_position.header.frame_id) {
217 throw std::invalid_argument("UTM-Position frame_id (" + utm_position.header.frame_id +
218 ") does not match the reference position frame_id (" + reference_position.header.frame_id +
219 ")");
220 }
221 setCartesianCoordinateWithConfidence(object.position.x_coordinate,
222 (utm_position.point.x - reference_position.point.x) * 100, x_confidence);
223 setCartesianCoordinateWithConfidence(object.position.y_coordinate,
224 (utm_position.point.y - reference_position.point.y) * 100, y_confidence);
225 if (utm_position.point.z != 0.0) {
226 setCartesianCoordinateWithConfidence(object.position.z_coordinate,
227 (utm_position.point.z - reference_position.point.z) * 100, z_confidence);
228 object.position.z_coordinate_is_present = true;
230}
231
233
242 */
243inline void setVelocityComponent(VelocityComponent& velocity, const int16_t value,
244 const uint8_t confidence = SpeedConfidence::UNAVAILABLE) {
245 // limit value range
246 if (value < VelocityComponentValue::NEGATIVE_OUT_OF_RANGE) {
247 velocity.value.value = VelocityComponentValue::NEGATIVE_OUT_OF_RANGE;
248 } else if (value > VelocityComponentValue::POSITIVE_OUT_OF_RANGE) {
249 velocity.value.value = VelocityComponentValue::POSITIVE_OUT_OF_RANGE;
250 } else {
251 velocity.value.value = value;
252 }
253
254 // limit confidence range
255 if (confidence > SpeedConfidence::MAX || confidence < SpeedConfidence::MIN) {
256 velocity.confidence.value = SpeedConfidence::OUT_OF_RANGE;
257 } else {
258 velocity.confidence.value = confidence;
259 }
260}
261
265
274inline void setVelocityOfPerceivedObject(PerceivedObject& object, const gm::Vector3& cartesian_velocity,
275 const uint8_t x_confidence = SpeedConfidence::UNAVAILABLE,
276 const uint8_t y_confidence = SpeedConfidence::UNAVAILABLE,
277 const uint8_t z_confidence = SpeedConfidence::UNAVAILABLE) {
278 object.velocity.choice = Velocity3dWithConfidence::CHOICE_CARTESIAN_VELOCITY;
279 setVelocityComponent(object.velocity.cartesian_velocity.x_velocity, cartesian_velocity.x * 100, x_confidence * 100);
280 setVelocityComponent(object.velocity.cartesian_velocity.y_velocity, cartesian_velocity.y * 100, y_confidence * 100);
281 if (cartesian_velocity.z != 0.0) {
282 setVelocityComponent(object.velocity.cartesian_velocity.z_velocity, cartesian_velocity.z * 100, z_confidence * 100);
283 object.velocity.cartesian_velocity.z_velocity_is_present = true;
284 }
285 object.velocity_is_present = true;
286}
287
297
299inline void setAccelerationComponent(AccelerationComponent& acceleration, const int16_t value,
300 const uint8_t confidence = AccelerationConfidence::UNAVAILABLE) {
301 // limit value range
302 if (value < AccelerationValue::NEGATIVE_OUT_OF_RANGE) {
303 acceleration.value.value = AccelerationValue::NEGATIVE_OUT_OF_RANGE;
304 } else if (value > AccelerationValue::POSITIVE_OUT_OF_RANGE) {
305 acceleration.value.value = AccelerationValue::POSITIVE_OUT_OF_RANGE;
306 } else {
307 acceleration.value.value = value;
308 }
310 // limit confidence range
311 if (confidence > AccelerationConfidence::MAX || confidence < AccelerationConfidence::MIN) {
312 acceleration.confidence.value = AccelerationConfidence::OUT_OF_RANGE;
313 } else {
314 acceleration.confidence.value = confidence;
315 }
316}
317
320
330inline void setAccelerationOfPerceivedObject(PerceivedObject& object, const gm::Vector3& cartesian_acceleration,
331 const uint8_t x_confidence = AccelerationConfidence::UNAVAILABLE,
332 const uint8_t y_confidence = AccelerationConfidence::UNAVAILABLE,
333 const uint8_t z_confidence = AccelerationConfidence::UNAVAILABLE) {
334 object.acceleration.choice = Acceleration3dWithConfidence::CHOICE_CARTESIAN_ACCELERATION;
335 setAccelerationComponent(object.acceleration.cartesian_acceleration.x_acceleration, cartesian_acceleration.x * 10,
336 x_confidence * 10);
337 setAccelerationComponent(object.acceleration.cartesian_acceleration.y_acceleration, cartesian_acceleration.y * 10,
338 y_confidence * 10);
339 if (cartesian_acceleration.z != 0.0) {
340 setAccelerationComponent(object.acceleration.cartesian_acceleration.z_acceleration, cartesian_acceleration.z * 10,
341 z_confidence * 10);
342 object.acceleration.cartesian_acceleration.z_acceleration_is_present = true;
343 }
344 object.acceleration_is_present = true;
345}
346
357inline void setYawOfPerceivedObject(PerceivedObject& object, const double yaw,
358 const uint8_t confidence = AngleConfidence::UNAVAILABLE) {
359 // wrap angle to range [0, 360]
360 double yaw_in_degrees = yaw * 180 / M_PI + 180; // TODO: check if this is correct
361 while (yaw_in_degrees > 360.0) yaw_in_degrees -= 360.0;
362 while (yaw_in_degrees < 0) yaw_in_degrees += 360.0;
363 object.angles.z_angle.value.value = yaw_in_degrees * 10;
364
365 if (confidence > AngleConfidence::MAX || confidence < AngleConfidence::MIN) {
366 object.angles.z_angle.confidence.value = AngleConfidence::OUT_OF_RANGE;
367 } else {
368 object.angles.z_angle.confidence.value = confidence;
370 object.angles_is_present = true;
371}
372
384inline void setYawRateOfPerceivedObject(PerceivedObject& object, const double yaw_rate,
385 const uint8_t confidence = AngularSpeedConfidence::UNAVAILABLE) {
386 int16_t yaw_rate_in_degrees = yaw_rate * 180 / M_PI;
387 if (yaw_rate_in_degrees != CartesianAngularVelocityComponentValue::UNAVAILABLE) {
388 // limit value range
389 if (yaw_rate_in_degrees < CartesianAngularVelocityComponentValue::NEGATIVE_OUTOF_RANGE) {
390 yaw_rate_in_degrees = CartesianAngularVelocityComponentValue::NEGATIVE_OUTOF_RANGE;
391 } else if (yaw_rate_in_degrees > CartesianAngularVelocityComponentValue::POSITIVE_OUT_OF_RANGE) {
392 yaw_rate_in_degrees = CartesianAngularVelocityComponentValue::POSITIVE_OUT_OF_RANGE;
393 }
394 }
395 object.z_angular_velocity.value.value = yaw_rate_in_degrees;
396 object.z_angular_velocity.confidence.value = confidence;
397 object.z_angular_velocity_is_present = true;
398}
399
400/**
401 * @brief Sets the object dimension with the given value and confidence.
402 *
403 * This function sets the value and confidence of the object dimension based on the provided parameters.
404 * The value is limited to the range defined by ObjectDimensionValue::MIN and ObjectDimensionValue::MAX.
405 * If the provided value is outside this range, the dimension value is set to ObjectDimensionValue::OUT_OF_RANGE.
406 *
407 * The confidence is limited to the range defined by ObjectDimensionConfidence::MIN and ObjectDimensionConfidence::MAX.
408 * If the provided confidence is outside this range, the confidence value is set to ObjectDimensionConfidence::OUT_OF_RANGE.
409 *
410 * @param dimension The object dimension to be set.
411 * @param value The value of the object dimension in decimeters.
412 * @param confidence The confidence of the object dimension in decimeters (optional, default is ObjectDimensionConfidence::UNAVAILABLE).
413 */
414inline void setObjectDimension(ObjectDimension& dimension, const uint16_t value,
415 const uint8_t confidence = ObjectDimensionConfidence::UNAVAILABLE) {
416 // limit value range
417 if (value < ObjectDimensionValue::MIN || value > ObjectDimensionValue::MAX) {
418 dimension.value.value = ObjectDimensionValue::OUT_OF_RANGE;
419 } else {
420 dimension.value.value = value;
421 }
422
423 // limit confidence range
424 if (confidence > ObjectDimensionConfidence::MAX || confidence < ObjectDimensionConfidence::MIN) {
425 dimension.confidence.value = ObjectDimensionConfidence::OUT_OF_RANGE;
426 } else {
427 dimension.confidence.value = confidence;
428 }
429}
430
441inline void setXDimensionOfPerceivedObject(PerceivedObject& object, const double value,
442 const uint8_t confidence = ObjectDimensionConfidence::UNAVAILABLE) {
443 setObjectDimension(object.object_dimension_x, (uint16_t)(value * 10), confidence * 10);
444 object.object_dimension_x_is_present = true;
445}
446
456 */
457inline void setYDimensionOfPerceivedObject(PerceivedObject& object, const double value,
458 const uint8_t confidence = ObjectDimensionConfidence::UNAVAILABLE) {
459 setObjectDimension(object.object_dimension_y, (uint16_t)(value * 10), confidence * 10);
460 object.object_dimension_y_is_present = true;
461}
462
472
473inline void setZDimensionOfPerceivedObject(PerceivedObject& object, const double value,
474 const uint8_t confidence = ObjectDimensionConfidence::UNAVAILABLE) {
475 setObjectDimension(object.object_dimension_z, (uint16_t)(value * 10), confidence * 10);
476 object.object_dimension_z_is_present = true;
477}
478
484 * @param object The perceived object to set the dimensions for.
485 * @param dimensions The dimensions of the object as a gm::Vector3 (x, y, z) in meters.
486 * @param x_confidence The confidence in meters for the x dimension (optional, default: ObjectDimensionConfidence::UNAVAILABLE).
487 * @param y_confidence The confidence in meters for the y dimension (optional, default: ObjectDimensionConfidence::UNAVAILABLE).
488 * @param z_confidence The confidence in meters for the z dimension (optional, default: ObjectDimensionConfidence::UNAVAILABLE).
489 */
490inline void setDimensionsOfPerceivedObject(PerceivedObject& object, const gm::Vector3& dimensions,
491 const uint8_t x_confidence = ObjectDimensionConfidence::UNAVAILABLE,
492 const uint8_t y_confidence = ObjectDimensionConfidence::UNAVAILABLE,
493 const uint8_t z_confidence = ObjectDimensionConfidence::UNAVAILABLE) {
494 setXDimensionOfPerceivedObject(object, dimensions.x, x_confidence);
495 setYDimensionOfPerceivedObject(object, dimensions.y, y_confidence);
496 setZDimensionOfPerceivedObject(object, dimensions.z, z_confidence);
497}
498
508inline void initPerceivedObject(PerceivedObject& object, const gm::Point& point, const int16_t delta_time = 0) {
509 setPositionOfPerceivedObject(object, point);
511}
512
525inline void initPerceivedObjectWithUTMPosition(CollectivePerceptionMessage& cpm, PerceivedObject& object,
526 const gm::PointStamped& point, const int16_t delta_time = 0) {
527 setUTMPositionOfPerceivedObject(cpm, object, point);
528 setMeasurementDeltaTimeOfPerceivedObject(object, delta_time);
529}
530
540inline void initPerceivedObjectContainer(WrappedCpmContainer& container, const uint8_t n_objects = 0) {
541 container.container_id.value = WrappedCpmContainer::CHOICE_CONTAINER_DATA_PERCEIVED_OBJECT_CONTAINER;
542 container.container_data_perceived_object_container.number_of_perceived_objects.value = n_objects;
543}
544
556
558inline void addPerceivedObjectToContainer(WrappedCpmContainer& container, const PerceivedObject& perceived_object) {
559 if (container.container_id.value == WrappedCpmContainer::CHOICE_CONTAINER_DATA_PERCEIVED_OBJECT_CONTAINER) {
560 container.container_data_perceived_object_container.perceived_objects.array.push_back(perceived_object);
561 container.container_data_perceived_object_container.number_of_perceived_objects.value =
562 container.container_data_perceived_object_container.perceived_objects.array.size();
563 } else {
564 throw std::invalid_argument("Container is not a PerceivedObjectContainer");
565 }
566}
572
580inline void addContainerToCPM(CollectivePerceptionMessage& cpm, const WrappedCpmContainer& container) {
581 // check for maximum number of containers
582 if (cpm.payload.cpm_containers.value.array.size() < WrappedCpmContainers::MAX_SIZE) {
583 cpm.payload.cpm_containers.value.array.push_back(container);
584 } else {
585 throw std::invalid_argument("Maximum number of CPM-Containers reached");
586 }
587}
588
589} // namespace etsi_its_cpm_ts_msgs::access
Setter functions for the ETSI ITS Common Data Dictionary (CDD) v2.1.1.
Sanity-check functions etc.
File containing constants that are used in the context of ETIS ITS Messages.
gm::PointStamped getUTMPosition(const T &reference_position, int &zone, bool &northp)
Get the UTM Position defined by the given ReferencePosition.
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 setCartesianCoordinateWithConfidence(CartesianCoordinateWithConfidence &coordinate, const int32_t value, const uint16_t confidence=CoordinateConfidence::UNAVAILABLE)
Sets the value and confidence of a CartesianCoordinateWithConfidence object.
void setDimensionsOfPerceivedObject(PerceivedObject &object, const gm::Vector3 &dimensions, const uint8_t x_confidence=ObjectDimensionConfidence::UNAVAILABLE, const uint8_t y_confidence=ObjectDimensionConfidence::UNAVAILABLE, const uint8_t z_confidence=ObjectDimensionConfidence::UNAVAILABLE)
Sets all dimensions of a perceived object.
void setUTMPositionOfPerceivedObject(CollectivePerceptionMessage &cpm, PerceivedObject &object, const gm::PointStamped &utm_position, const uint16_t x_confidence=CoordinateConfidence::UNAVAILABLE, const uint16_t y_confidence=CoordinateConfidence::UNAVAILABLE, const uint16_t z_confidence=CoordinateConfidence::UNAVAILABLE)
Sets the position of a perceived object based on a UTM position.
void setVelocityComponent(VelocityComponent &velocity, const int16_t value, const uint8_t confidence=SpeedConfidence::UNAVAILABLE)
Sets the value and confidence of a VelocityComponent.
void initPerceivedObjectContainer(WrappedCpmContainer &container, const uint8_t n_objects=0)
Initializes a WrappedCpmContainer as a PerceivedObjectContainer with the given number of objects.
void setYDimensionOfPerceivedObject(PerceivedObject &object, const double value, const uint8_t confidence=ObjectDimensionConfidence::UNAVAILABLE)
Sets the y-dimension of a perceived object.
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.
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 setObjectDimension(ObjectDimension &dimension, const uint16_t value, const uint8_t confidence=ObjectDimensionConfidence::UNAVAILABLE)
Sets the object dimension with the given value and confidence.
void addContainerToCPM(CollectivePerceptionMessage &cpm, const WrappedCpmContainer &container)
Adds a container to the Collective Perception Message (CPM).
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.
void setIdOfPerceivedObject(PerceivedObject &object, const uint16_t id)
Set the ID of a PerceivedObject.
void setReferenceTime(CollectivePerceptionMessage &cpm, const uint64_t unix_nanosecs, const uint16_t n_leap_seconds=etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end() ->second)
Sets the reference time in a CPM.
void setTimestampITS(TimestampIts &timestamp_its, const uint64_t unix_nanosecs, const uint16_t n_leap_seconds=etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end() ->second)
Set the TimestampITS object.
void setXDimensionOfPerceivedObject(PerceivedObject &object, const double value, const uint8_t confidence=ObjectDimensionConfidence::UNAVAILABLE)
Sets the x-dimension of a perceived object.
void setMeasurementDeltaTimeOfPerceivedObject(PerceivedObject &object, const int16_t delta_time=0)
Sets the measurement delta time of a PerceivedObject.
void setAccelerationOfPerceivedObject(PerceivedObject &object, const gm::Vector3 &cartesian_acceleration, const uint8_t x_confidence=AccelerationConfidence::UNAVAILABLE, const uint8_t y_confidence=AccelerationConfidence::UNAVAILABLE, const uint8_t z_confidence=AccelerationConfidence::UNAVAILABLE)
Sets the acceleration of a perceived object.
void setPositionOfPerceivedObject(PerceivedObject &object, const gm::Point &point, const uint16_t x_confidence=CoordinateConfidence::UNAVAILABLE, const uint16_t y_confidence=CoordinateConfidence::UNAVAILABLE, const uint16_t z_confidence=CoordinateConfidence::UNAVAILABLE)
Sets the position of a perceived object (relative to the CPM's reference position).
void setZDimensionOfPerceivedObject(PerceivedObject &object, const double value, const uint8_t confidence=ObjectDimensionConfidence::UNAVAILABLE)
Sets the z-dimension of a perceived object.
void setAccelerationComponent(AccelerationComponent &acceleration, const int16_t value, const uint8_t confidence=AccelerationConfidence::UNAVAILABLE)
Sets the value and confidence of a AccelerationComponent.