diff --git a/README.md b/README.md index daf66ac7..bc6ef674 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ All message definitions and conversion functions are automatically generated bas - [Packages](#packages) - [Installation](#installation) - [Conversion Node](#conversion-node) +- [Sample Messages](#sample-messages) - [Access Functions](#access-functions) - [Code Generation](#code-generation) - [V2AIX Dataset / Citation](#v2aix-dataset--citation) @@ -192,6 +193,36 @@ rosrun nodelet nodelet standalone etsi_its_conversion/Converter _etsi_types:=[ca | `check_constraints_before_encoding` | `bool` | whether an asn constraint check should be performed before encoding using asn1c's `asn_check_constraints` function (setting to `true` could lead to segmentation faults because of infinite recursion; [known asn1c issue](https://github.com/vlm/asn1c/issues/410)) | +## Sample Messages + +The `etsi_its_msgs_utils` package contains simple ROS 2 nodes for publishing sample ROS 2 messages of the supported ETSI ITS message types, see [`./etsi_its_msgs_utils/samples/`](./etsi_its_msgs_utils/samples/). For example, publish a sample CPM by running the following. + +```bash +# ROS 2 only +ros2 run etsi_its_msgs_utils publish_cpm_ts.py +``` + +You can then visualize the CPM in RViz with the provided demo configuration. + +```bash +# ROS 2 only +ros2 launch etsi_its_rviz_plugins demo.launch.py +``` + +And finally, run the [Conversion Node](#conversion-node) to convert ROS 2 messages to binary payloads. + +```bash +# ROS 2 only +ros2 run etsi_its_conversion etsi_its_conversion_node \ + --ros-args \ + -r __node:=etsi_its_conversion \ + -r /etsi_its_conversion/udp/out:=/etsi_its_conversion/udp/in \ + -p has_btp_destination_port:=true \ + -p btp_destination_port_offset:=0 \ + -p etsi_message_payload_offset:=4 +``` + + ## Access Functions The `etsi_its_msgs_utils` package contains header-only libraries providing helpful access functions for modifying the deeply nested ROS messages equivalents of the ETSI ITS messages. All access functions are [documented here](https://ika-rwth-aachen.github.io/etsi_its_messages/). diff --git a/etsi_its_msgs_utils/CMakeLists.txt b/etsi_its_msgs_utils/CMakeLists.txt index 9e377f8b..a664c879 100644 --- a/etsi_its_msgs_utils/CMakeLists.txt +++ b/etsi_its_msgs_utils/CMakeLists.txt @@ -36,6 +36,17 @@ if(${ROS_VERSION} EQUAL 2) DESTINATION include/${PROJECT_NAME} ) + # install all sample python scripts + file(GLOB SAMPLE_SCRIPTS "samples/publish_*.py") + install( + FILES "samples/utils.py" + DESTINATION lib/${PROJECT_NAME} + ) + install( + PROGRAMS ${SAMPLE_SCRIPTS} + DESTINATION lib/${PROJECT_NAME} + ) + install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets ARCHIVE DESTINATION lib diff --git a/utils/scripts/publish_cam.py b/etsi_its_msgs_utils/samples/publish_cam.py similarity index 100% rename from utils/scripts/publish_cam.py rename to etsi_its_msgs_utils/samples/publish_cam.py diff --git a/utils/scripts/publish_cam_ts.py b/etsi_its_msgs_utils/samples/publish_cam_ts.py similarity index 100% rename from utils/scripts/publish_cam_ts.py rename to etsi_its_msgs_utils/samples/publish_cam_ts.py diff --git a/utils/scripts/publish_cpm_ts.py b/etsi_its_msgs_utils/samples/publish_cpm_ts.py similarity index 91% rename from utils/scripts/publish_cpm_ts.py rename to etsi_its_msgs_utils/samples/publish_cpm_ts.py index 3ada73a7..dd770bdc 100755 --- a/utils/scripts/publish_cpm_ts.py +++ b/etsi_its_msgs_utils/samples/publish_cpm_ts.py @@ -67,10 +67,13 @@ def publish(self): perceived_object.position.y_coordinate.confidence.value = perceived_object.position.y_coordinate.confidence.UNAVAILABLE perceived_object.object_dimension_x_is_present = True perceived_object.object_dimension_x.value.value = int(3.5 * 1e1) + perceived_object.object_dimension_x.confidence.value = perceived_object.object_dimension_x.confidence.UNAVAILABLE perceived_object.object_dimension_y_is_present = True perceived_object.object_dimension_y.value.value = int(1.8 * 1e1) + perceived_object.object_dimension_y.confidence.value = perceived_object.object_dimension_y.confidence.UNAVAILABLE perceived_object.object_dimension_z_is_present = True perceived_object.object_dimension_z.value.value = int(1.6 * 1e1) + perceived_object.object_dimension_z.confidence.value = perceived_object.object_dimension_z.confidence.UNAVAILABLE perceived_object_container.perceived_objects.array.append(perceived_object) cpm_container.container_data.perceived_object_container = perceived_object_container diff --git a/utils/scripts/publish_cpm_ts_multi_wrapped_container.py b/etsi_its_msgs_utils/samples/publish_cpm_ts_multi_wrapped_container.py similarity index 99% rename from utils/scripts/publish_cpm_ts_multi_wrapped_container.py rename to etsi_its_msgs_utils/samples/publish_cpm_ts_multi_wrapped_container.py index ccd215c7..4b205ff4 100755 --- a/utils/scripts/publish_cpm_ts_multi_wrapped_container.py +++ b/etsi_its_msgs_utils/samples/publish_cpm_ts_multi_wrapped_container.py @@ -24,6 +24,8 @@ # SOFTWARE. # ============================================================================== +# Sample CPM from 4th ETSI C-V2X Plugtests, Malaga/ESP, Sep 2024 + import rclpy from rclpy.node import Node from etsi_its_cpm_ts_msgs.msg import * diff --git a/utils/scripts/publish_cpm_ts_sensor_information.py b/etsi_its_msgs_utils/samples/publish_cpm_ts_sensor_information.py similarity index 98% rename from utils/scripts/publish_cpm_ts_sensor_information.py rename to etsi_its_msgs_utils/samples/publish_cpm_ts_sensor_information.py index bc3b8b08..427e25ca 100755 --- a/utils/scripts/publish_cpm_ts_sensor_information.py +++ b/etsi_its_msgs_utils/samples/publish_cpm_ts_sensor_information.py @@ -24,6 +24,8 @@ # SOFTWARE. # ============================================================================== +# Sample CPM from 4th ETSI C-V2X Plugtests, Malaga/ESP, Sep 2024 + import rclpy from rclpy.node import Node from etsi_its_cpm_ts_msgs.msg import * diff --git a/utils/scripts/publish_denm.py b/etsi_its_msgs_utils/samples/publish_denm.py similarity index 100% rename from utils/scripts/publish_denm.py rename to etsi_its_msgs_utils/samples/publish_denm.py diff --git a/utils/scripts/publish_vam_ts.py b/etsi_its_msgs_utils/samples/publish_vam_ts.py similarity index 100% rename from utils/scripts/publish_vam_ts.py rename to etsi_its_msgs_utils/samples/publish_vam_ts.py diff --git a/utils/scripts/utils.py b/etsi_its_msgs_utils/samples/utils.py similarity index 100% rename from utils/scripts/utils.py rename to etsi_its_msgs_utils/samples/utils.py diff --git a/utils/scripts/README.md b/utils/scripts/README.md deleted file mode 100644 index 19fc41c7..00000000 --- a/utils/scripts/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Testing and Utility Scripts - -## Testing - -Test the conversion node by publishing ETSI messages in ROS, converting them to UDP bitstrings, and back to ROS messages. - -```bash -ros2 run etsi_its_conversion etsi_its_conversion_node \ - --ros-args \ - -r __node:=etsi_its_conversion \ - -r /etsi_its_conversion/udp/out:=/etsi_its_conversion/udp/in \ - -p has_btp_destination_port:=true \ - -p btp_destination_port_offset:=0 \ - -p etsi_message_payload_offset:=4 -``` - -```bash -./publish_cam.py -``` - -```bash -./publish_denm.py -``` - -```bash -./publish_cpm_ts.py -``` - -```bash -./publish_vam_ts.py -``` \ No newline at end of file