Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions etsi_its_msgs_utils/include/etsi_its_msgs_utils/denm_ts_access.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
=============================================================================
MIT License

Copyright (c) 2023-2025 Institute for Automotive Engineering (ika), RWTH Aachen University

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=============================================================================
*/

/**
* @file denm_ts_access.hpp
* @brief Main DENM TS access header to include in ROS 2 projects
*/

#pragma once

// Messages
#include <etsi_its_denm_ts_msgs/msg/denm.hpp>
#include <geometry_msgs/msg/point_stamped.hpp>

namespace etsi_its_denm_ts_msgs {
using namespace msg;
namespace gm = geometry_msgs::msg;
}

// Implementation
#include <etsi_its_msgs_utils/impl/denm/denm_ts_access.h>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SOFTWARE.

/**
* @file impl/cdd/cdd_getters_common.h
* @brief Common getter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1 and v2.1.1
* @brief Common getter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1, v2.1.1 and v2.2.1
*/

#ifndef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_GETTERS_COMMON_H
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SOFTWARE.

/**
* @file impl/cdd/cdd_setters_common.h
* @brief Common setter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1 and v2.1.1
* @brief Common setter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1, v2.1.1 and v2.2.1
*/

#ifndef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_SETTERS_COMMON_H
Expand All @@ -41,6 +41,30 @@ SOFTWARE.
#include <cstring>
#include <type_traits>

/**
* @brief Set the Station Id object
*
* @param station_id
* @param id_value
*/
template <typename StationId>
inline void setStationId(StationId& station_id, const uint32_t id_value) {
throwIfOutOfRange(id_value, StationId::MIN, StationId::MAX, "StationId");
station_id.value = id_value;
}

/**
* @brief Set the Station Type
*
* @param station_type
* @param value
*/
template <typename StationType>
inline void setStationType(StationType& station_type, const uint8_t value) {
throwIfOutOfRange(value, StationType::MIN, StationType::MAX, "StationType");
station_type.value = value;
}

/**
* @brief Set the TimestampITS object
*
Expand Down Expand Up @@ -484,6 +508,4 @@ inline void setWGSPosConfidenceEllipse(PosConfidenceEllipse& position_confidence
setPosConfidenceEllipse(position_confidence_ellipse, semi_major_axis, semi_minor_axis, orientation);
}



#endif // ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_SETTERS_COMMON_H
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@ SOFTWARE.
#include <GeographicLib/UTMUPS.hpp>
#include <cstring>

/**
* @brief Set the Station Id object
*
* @param station_id
* @param id_value
*/
inline void setStationId(StationID& station_id, const uint32_t id_value) {
throwIfOutOfRange(id_value, StationID::MIN, StationID::MAX, "StationID");
station_id.value = id_value;
}

/**
* @brief Set the Its Pdu Header object
*
Expand All @@ -66,15 +55,4 @@ inline void setItsPduHeader(ItsPduHeader& header, const uint8_t message_id, cons
header.protocol_version = protocol_version;
}

/**
* @brief Set the Station Type
*
* @param station_type
* @param value
*/
inline void setStationType(StationType& station_type, const uint8_t value) {
throwIfOutOfRange(value, StationType::MIN, StationType::MAX, "StationType");
station_type.value = value;
}

#endif // ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V1_3_1_SETTERS_H
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@ SOFTWARE.
#include <GeographicLib/UTMUPS.hpp>
#include <cstring>

/**
* @brief Set the Station Id object
*
* @param station_id
* @param id_value
*/
inline void setStationId(StationId& station_id, const uint32_t id_value) {
throwIfOutOfRange(id_value, StationId::MIN, StationId::MAX, "StationId");
station_id.value = id_value;
}

/**
* @brief Set the Its Pdu Header object
*
Expand All @@ -65,17 +54,6 @@ inline void setItsPduHeader(ItsPduHeader& header, const uint8_t message_id, cons
header.protocol_version.value = protocol_version;
}

/**
* @brief Set the Station Type
*
* @param station_type
* @param value
*/
inline void setStationType(TrafficParticipantType& station_type, const uint8_t value) {
throwIfOutOfRange(value, TrafficParticipantType::MIN, TrafficParticipantType::MAX, "StationType");
station_type.value = value;
}

/**
* @brief Set the LongitudinalAccelerationValue object
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
=============================================================================
MIT License

Copyright (c) 2023-2025 Institute for Automotive Engineering (ika), RWTH Aachen University

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=============================================================================
*/

/**
* @file impl/cdd/cdd_v2-2-1_getters.h
* @brief Getter functions for the ETSI ITS Common Data Dictionary (CDD) v2.2.1
*/

#ifndef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_2_1_GETTERS_H
#define ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_2_1_GETTERS_H
#include <GeographicLib/UTMUPS.hpp>

#include <etsi_its_msgs_utils/impl/cdd/cdd_getters_common.h>

/**
* @brief Get the WGS Heading value
*
* 0.0° equals WGS84 North, 90.0° equals WGS84 East, 180.0° equals WGS84 South and 270.0° equals WGS84 West
*
* @param heading to get the WGS Heading value from
* @return WGS Heading value in degree as decimal number
*/
template <typename Wgs84Angle>
inline double getWGSHeadingCDD(const Wgs84Angle& heading) { return ((double)heading.value.value) * 1e-1; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason for this CDD postfix in the function-name? I think we're not having these for the ohter setter/getter functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CDD postfix is already used for low-level CDD functions (e.g. getHeadingCDD(), setHeadingCDD(), getYawRateCDD() in cdd_*_common.h). The message-level access functions stay without postfix. getWGSHeadingCDD() follows the same pattern.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason for this CDD postfix? I think we're not having these for the


/**
* @brief Get the WGS Heading confidence
*
* 0.0° equals WGS84 North, 90.0° equals WGS84 East, 180.0° equals WGS84 South and 270.0° equals WGS84 West
*
* @param heading to get the WGS Heading standard deviation from
* @return WGS Heading standard deviation in degree as decimal number
*/

template <typename Wgs84Angle>
inline double getWGSHeadingConfidenceCDD(const Wgs84Angle& heading) { return ((double)heading.confidence.value) * 1e-1 / etsi_its_msgs::ONE_D_GAUSSIAN_FACTOR; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: CDD postfix?


#endif // ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_2_1_GETTERS_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
=============================================================================
MIT License

Copyright (c) 2023-2025 Institute for Automotive Engineering (ika), RWTH Aachen University

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=============================================================================
*/

/**
* @file impl/cdd/cdd_v2-2-1_setters.h
* @brief Setter functions for the ETSI ITS Common Data Dictionary (CDD) v2.2.1
*/

#ifndef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_2_1_SETTERS_H
#define ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_2_1_SETTERS_H

#include <etsi_its_msgs_utils/impl/cdd/cdd_setters_common.h>
#include <etsi_its_msgs_utils/impl/checks.h>
#include <GeographicLib/UTMUPS.hpp>
#include <cstring>

/**
* @brief Set the Its Pdu Header object
*
* @param header ItsPduHeader to be set
* @param message_id ID of the message
* @param station_id
* @param protocol_version
*/
inline void setItsPduHeader(ItsPduHeader& header, const uint8_t message_id, const uint32_t station_id,
const uint8_t protocol_version = 0) {
setStationId(header.station_id, station_id);
throwIfOutOfRange(message_id, MessageId::MIN, MessageId::MAX, "MessageID");
header.message_id.value = message_id;
throwIfOutOfRange(protocol_version, OrdinalNumber1B::MIN, OrdinalNumber1B::MAX, "ProtocolVersion");
header.protocol_version.value = protocol_version;
}

/**
* @brief Set the Wgs84AngleValue object
*
* 0.0° equals WGS84 North, 90.0° equals WGS84 East, 180.0° equals WGS84 South and 270.0° equals WGS84 West
*
* @param heading object to set
* @param value Heading value in degree as decimal number
*/
template <typename Wgs84AngleValue>
inline void setWGSHeadingValue(Wgs84AngleValue& heading, const double value) {
int64_t deg = (int64_t)std::round(value * 1e1);
throwIfOutOfRange(deg, Wgs84AngleValue::MIN, Wgs84AngleValue::MAX, "Wgs84AngleValue");
heading.value = deg;
}

/**
* @brief Set the Wgs84AngleConfidence object
*
* @param confidence object to set
* @param value standard deviation of heading in degree as decimal number
*/
template<typename Wgs84AngleConfidence>
inline void setWGSHeadingConfidence(Wgs84AngleConfidence& confidence, const double value) {
auto heading_conf = std::round(value * 1e1 * etsi_its_msgs::ONE_D_GAUSSIAN_FACTOR);
if (heading_conf < Wgs84AngleConfidence::MIN && heading_conf > 0.0){
heading_conf = Wgs84AngleConfidence::MIN;
} else if (heading_conf >= Wgs84AngleConfidence::OUT_OF_RANGE || heading_conf <= 0.0) {
heading_conf = Wgs84AngleConfidence::UNAVAILABLE;
}
confidence.value = static_cast<decltype(confidence.value)>(heading_conf);
}

/**
* @brief Set the Wgs84Angle object
*
* 0.0° equals WGS84 North, 90.0° equals WGS84 East, 180.0° equals WGS84 South and 270.0° equals WGS84 West
* Wgs84AngleConfidence is set to UNAVAILABLE
*
* @param heading object to set
* @param value Heading value in degree as decimal number
* @param confidence standard deviation of heading in degree as decimal number (default: infinity, mapping to Wgs84AngleConfidence::UNAVAILABLE)
*/
template <typename Wgs84Angle, typename Wgs84AngleConfidence = decltype(Wgs84Angle::confidence)>
void setWGSHeadingCDD(Wgs84Angle& heading, const double value, double confidence = std::numeric_limits<double>::infinity()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: CDD postfix?

setWGSHeadingConfidence(heading.confidence, confidence);
setWGSHeadingValue(heading.value, value);
}

#endif // ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_2_1_SETTERS_H
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ SOFTWARE.

#undef ETSI_ITS_MSGS_UTILS_IMPL_ASN1_PRIMITIVES_ASN1_PRIMITIVES_GETTERS_H
#undef ETSI_ITS_MSGS_UTILS_IMPL_ASN1_PRIMITIVES_ASN1_PRIMITIVES_SETTERS_H
#undef ETSI_ITS_MSGS_UTILS_IMPL_DENM_DENM_GETTERS_COMMON_H
#undef ETSI_ITS_MSGS_UTILS_IMPL_DENM_DENM_SETTERS_COMMON_H
#undef ETSI_ITS_MSGS_UTILS_IMPL_DENM_DENM_UTILS_H
#undef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_GETTERS_COMMON_H
#undef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_SETTERS_COMMON_H
#undef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V1_3_1_GETTERS_H
#undef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V1_3_1_SETTERS_H
#undef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_1_1_GETTERS_H
#undef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_1_1_SETTERS_H
#undef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_2_1_GETTERS_H
#undef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_2_1_SETTERS_H
#undef ETSI_ITS_MSGS_UTILS_IMPL_CHECKS_H

#pragma once
Expand Down
Loading