-
Notifications
You must be signed in to change notification settings - Fork 23
Add DENM TS access functions #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gkueppers
merged 6 commits into
ika-rwth-aachen:main
from
es-av-it-pt:denm-ts-access-functions
Mar 11, 2026
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b58253e
add initial DENM TS access and common getter/setter headers
jdvoliveira 5ac6375
add DENM TS access functions and new CDD v2.2.1 setters/getters
jdvoliveira 4e9fa46
add tests for DENM TS access functions
jdvoliveira be2d5e4
minor improvements to DENM TS access functions
jdvoliveira 37c18d6
fix #undef for header guards and improve naming
jdvoliveira 7b38130
add tests for (Sub)CauseCode in DENM EN/TS access functions
jdvoliveira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
etsi_its_msgs_utils/include/etsi_its_msgs_utils/denm_ts_access.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
etsi_its_msgs_utils/include/etsi_its_msgs_utils/impl/cdd/cdd_v2-2-1_getters.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; } | ||
gkueppers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * @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; } | ||
gkueppers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #endif // ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_2_1_GETTERS_H | ||
105 changes: 105 additions & 0 deletions
105
etsi_its_msgs_utils/include/etsi_its_msgs_utils/impl/cdd/cdd_v2-2-1_setters.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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()) { | ||
gkueppers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| setWGSHeadingConfidence(heading.confidence, confidence); | ||
| setWGSHeadingValue(heading.value, value); | ||
| } | ||
|
|
||
| #endif // ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_2_1_SETTERS_H | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.