From bb4dcead8a71130b6b4a42352627a27dd074c30c Mon Sep 17 00:00:00 2001 From: Anish_deva <51463994+adev4a@users.noreply.github.com> Date: Tue, 22 Oct 2024 15:31:51 -0400 Subject: [PATCH 1/6] fix time from header calc (#231) # PR Details This PR fixes the timestamp calculation for the generated mobility message. Currently the package uses the second field from the GPSFix message constructed from the torc pinpoint driver's input, but ideally the nanosecond field should also be used. The fix updates the implementation by converting the header field to a nanoseconds value which is then used to calculate the required timestamp in milliseconds. ## Description ## Related GitHub Issue ## Related Jira Key ## Motivation and Context ## How Has This Been Tested? ## Types of changes - [x] Defect fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that cause existing functionality to change) ## Checklist: - [ ] I have added any new packages to the sonar-scanner.properties file - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [x] I have read the [**CONTRIBUTING**](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md) document. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. --- .../traffic_incident/src/traffic_incident_worker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/carma-messenger-core/traffic_incident/src/traffic_incident_worker.cpp b/carma-messenger-core/traffic_incident/src/traffic_incident_worker.cpp index 1651403f..6c460c3f 100644 --- a/carma-messenger-core/traffic_incident/src/traffic_incident_worker.cpp +++ b/carma-messenger-core/traffic_incident/src/traffic_incident_worker.cpp @@ -35,7 +35,7 @@ carma_v2x_msgs::msg::MobilityOperation TrafficIncidentWorker::mobilityMessageGen { carma_v2x_msgs::msg::MobilityOperation traffic_mobility_msg; - traffic_mobility_msg.m_header.timestamp = pinpoint_msg.header.stamp.sec * 1000; + traffic_mobility_msg.m_header.timestamp = rclcpp::Time(pinpoint_msg.header.stamp).nanoseconds() / 1e6; traffic_mobility_msg.m_header.sender_id = sender_id_; traffic_mobility_msg.strategy = USE_CASE_NAME_; From 32b8307ce25517ccca3a256e3e94bcc73e32d92a Mon Sep 17 00:00:00 2001 From: Misheel Bayartsengel Date: Wed, 6 Nov 2024 12:37:35 -0500 Subject: [PATCH 2/6] remove wait-for-it-sh dependence (#240) # PR Details ## Description Removing `wait-for-it.sh` symlink to `wait-for-it` because it is not needed. ## Related GitHub Issue NA ## Related Jira Key NA ## Motivation and Context Upgrade to ROS2 Humble, thought I might fix this. ## How Has This Been Tested? Tested this on previous 4.5.0 image by removing the symlink the package itself works fine directly ![image](https://github.com/user-attachments/assets/241324c0-356b-432a-8442-045c6b021a8a) ## Types of changes - [ ] Defect fix (non-breaking change that fixes an issue) - [X] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that cause existing functionality to change) ## Checklist: - [X] I have added any new packages to the sonar-scanner.properties file - [X] My change requires a change to the documentation. - [X] I have updated the documentation accordingly. - [X] I have read the [**CONTRIBUTING**](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md) document. - [X] I have added tests to cover my changes. - [X] All new and existing tests passed. --- .../chevrolet_tahoe_2018/docker-compose.yml | 4 ++-- carma-messenger-config/development/docker-compose.yml | 4 ++-- carma-messenger-core/Dockerfile | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/carma-messenger-config/chevrolet_tahoe_2018/docker-compose.yml b/carma-messenger-config/chevrolet_tahoe_2018/docker-compose.yml index c74fd543..22952d1f 100755 --- a/carma-messenger-config/chevrolet_tahoe_2018/docker-compose.yml +++ b/carma-messenger-config/chevrolet_tahoe_2018/docker-compose.yml @@ -40,7 +40,7 @@ services: - /opt/carma/logs:/opt/carma/logs - /opt/carma/.ros:/home/carma/.ros # Use the dynamic_bridge instead of the parameter bridge as the number of topics is small enough to pose less of a latency issue - command: bash -c 'wait-for-it.sh localhost:11311 -- rosparam load /opt/carma/vehicle/config/bridge.yml && source ~/.base-image/workspace/install/setup.bash && ros2 run ros1_bridge dynamic_bridge --multi-threads' + command: bash -c 'wait-for-it localhost:11311 -- rosparam load /opt/carma/vehicle/config/bridge.yml && source ~/.base-image/workspace/install/setup.bash && ros2 run ros1_bridge dynamic_bridge --multi-threads' messenger: image: ${DOCKER_ORG}/carma-messenger-core:${DOCKER_TAG} @@ -53,7 +53,7 @@ services: volumes: - /opt/carma/logs:/opt/carma/logs - /opt/carma/.ros:/opt/carma/.ros - command: wait-for-it.sh localhost:11311 -- roslaunch /opt/carma/vehicle/config/carma-messenger-docker.launch + command: wait-for-it localhost:11311 -- roslaunch /opt/carma/vehicle/config/carma-messenger-docker.launch messenger_ros2: image: ${DOCKER_ORG}/carma-messenger-core:${DOCKER_TAG} diff --git a/carma-messenger-config/development/docker-compose.yml b/carma-messenger-config/development/docker-compose.yml index 8320238f..425f3115 100755 --- a/carma-messenger-config/development/docker-compose.yml +++ b/carma-messenger-config/development/docker-compose.yml @@ -37,7 +37,7 @@ services: - /opt/carma/logs:/opt/carma/logs - /opt/carma/.ros:/home/carma/.ros # Use the dynamic_bridge instead of the parameter bridge as the number of topics is small enough to pose less of a latency issue - command: bash -c 'wait-for-it.sh localhost:11311 -- rosparam load /opt/carma/vehicle/config/bridge.yml && source ~/.base-image/workspace/install/setup.bash && ros2 run ros1_bridge dynamic_bridge --multi-threads' + command: bash -c 'wait-for-it localhost:11311 -- rosparam load /opt/carma/vehicle/config/bridge.yml && source ~/.base-image/workspace/install/setup.bash && ros2 run ros1_bridge dynamic_bridge --multi-threads' messenger: image: ${DOCKER_ORG}/carma-messenger-core:${DOCKER_TAG} @@ -49,7 +49,7 @@ services: - /opt/carma/logs:/opt/carma/logs - /opt/carma/.ros:/opt/carma/.ros - /opt/carma/vehicle:/opt/carma/vehicle - command: wait-for-it.sh localhost:11311 -- roslaunch /opt/carma/vehicle/config/carma-messenger-docker.launch + command: wait-for-it localhost:11311 -- roslaunch /opt/carma/vehicle/config/carma-messenger-docker.launch messenger_ros2: image: ${DOCKER_ORG}/carma-messenger-core:${DOCKER_TAG} diff --git a/carma-messenger-core/Dockerfile b/carma-messenger-core/Dockerfile index 4ab0f88c..264cc1e8 100755 --- a/carma-messenger-core/Dockerfile +++ b/carma-messenger-core/Dockerfile @@ -45,4 +45,4 @@ RUN sudo chmod -R +x /opt/carma/install RUN pip install future -CMD [ "wait-for-it.sh", "localhost:11311", "--", "roslaunch", "carma-messenger", "carma-messenger.launch"] +CMD [ "wait-for-it", "localhost:11311", "--", "roslaunch", "carma-messenger", "carma-messenger.launch"] From 9b45c934ef575ba52b52dfc5ce416c95bc46d001 Mon Sep 17 00:00:00 2001 From: Anish_deva <51463994+adev4a@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:08:35 -0500 Subject: [PATCH 3/6] add ros2 rosbag recording (#241) # PR Details This PR adds ros2 rosbag recording to carma-messenger. ## Description ## Related GitHub Issue ## Related Jira Key ## Motivation and Context ## How Has This Been Tested? Tested locally. ## Types of changes - [ ] Defect fix (non-breaking change that fixes an issue) - [x] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that cause existing functionality to change) ## Checklist: - [ ] I have added any new packages to the sonar-scanner.properties file - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [x] I have read the [**CONTRIBUTING**](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md) document. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. --- .../config/rosbag2_qos_overrides.yaml | 7 +++ .../launch/carma-messenger.launch.py | 18 +++++- .../launch/ros2_rosbag.launch.py | 56 +++++++++++++++++++ 3 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 carma-messenger-core/carma-messenger/config/rosbag2_qos_overrides.yaml create mode 100644 carma-messenger-core/carma-messenger/launch/ros2_rosbag.launch.py diff --git a/carma-messenger-core/carma-messenger/config/rosbag2_qos_overrides.yaml b/carma-messenger-core/carma-messenger/config/rosbag2_qos_overrides.yaml new file mode 100644 index 00000000..42c5b6ed --- /dev/null +++ b/carma-messenger-core/carma-messenger/config/rosbag2_qos_overrides.yaml @@ -0,0 +1,7 @@ +## This file defines Quality of Service settings for subscribers created in rosbag2 recording. +## Topics defined here have multiple publishers with different QoS settings which may lead to the rosbag ignoring messages. +## The QoS settings defined here give the subscriber less restrictive settings, so all messages from the topic are retained. +/rosout: + history: keep_all + reliability: reliable + durability: volatile \ No newline at end of file diff --git a/carma-messenger-core/carma-messenger/launch/carma-messenger.launch.py b/carma-messenger-core/carma-messenger/launch/carma-messenger.launch.py index e1cd8c16..5be48272 100644 --- a/carma-messenger-core/carma-messenger/launch/carma-messenger.launch.py +++ b/carma-messenger-core/carma-messenger/launch/carma-messenger.launch.py @@ -58,7 +58,7 @@ def generate_launch_description(): actions=[ IncludeLaunchDescription( PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/message.launch.py']), - launch_arguments = { + launch_arguments = { 'configuration_delay' : [configuration_delay] }.items() ), @@ -69,7 +69,7 @@ def generate_launch_description(): actions=[ IncludeLaunchDescription( PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/plugins.launch.py']), - launch_arguments = { + launch_arguments = { 'configuration_delay' : [configuration_delay], 'route_file_folder' : route_file_folder }.items() @@ -93,6 +93,17 @@ def generate_launch_description(): ] ) + + # Launch ROS2 rosbag logging + ros2_rosbag_launch = GroupAction( + actions=[ + IncludeLaunchDescription( + PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/ros2_rosbag.launch.py']), + ) + ] + ) + + return LaunchDescription([ declare_configuration_delay_arg, declare_route_file_folder, @@ -100,5 +111,6 @@ def generate_launch_description(): v2x_group, plugins_group, ui_group, - traffic_incident_group + traffic_incident_group, + ros2_rosbag_launch ]) diff --git a/carma-messenger-core/carma-messenger/launch/ros2_rosbag.launch.py b/carma-messenger-core/carma-messenger/launch/ros2_rosbag.launch.py new file mode 100644 index 00000000..46217123 --- /dev/null +++ b/carma-messenger-core/carma-messenger/launch/ros2_rosbag.launch.py @@ -0,0 +1,56 @@ +# Copyright (C) 2024 LEIDOS. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from launch import LaunchDescription, LaunchContext +from launch_ros.actions import Node +from launch.actions import OpaqueFunction +from launch.substitutions import LaunchConfiguration +from launch.actions import DeclareLaunchArgument, ExecuteProcess +from launch.substitutions import PathJoinSubstitution +from launch_ros.substitutions import FindPackageShare + +from datetime import datetime +import pathlib +import yaml + +# This function is used to generate a command to record a ROS 2 rosbag that excludes topics +# topics as provided in the appropriate configuration file. +def record_ros2_rosbag(context: LaunchContext, rosbag2_qos_override_param_file): + + overriding_qos_profiles = context.perform_substitution(rosbag2_qos_override_param_file) + + proc = ExecuteProcess( + cmd=['ros2', 'bag', 'record', '-s', 'mcap', '--qos-profile-overrides-path', overriding_qos_profiles, '-o', '/opt/carma/logs/rosbag2_' + str(datetime.now().strftime('%Y-%m-%d_%H%M%S')), '-a'], + output='screen', + shell='true' + ) + + return [proc] + + +def generate_launch_description(): + rosbag2_qos_override_param_file = LaunchConfiguration('rosbag2_qos_override_param_file') + declare_rosbag2_qos_override_param_file = DeclareLaunchArgument( + name='rosbag2_qos_override_param_file', + default_value = PathJoinSubstitution([ + FindPackageShare('carma-messenger'),'config', + 'rosbag2_qos_overrides.yaml' + ]), + description = "Path to file containing rosbag2 override qos settings" + ) + + return LaunchDescription([ + declare_rosbag2_qos_override_param_file, + OpaqueFunction(function=record_ros2_rosbag, args=[rosbag2_qos_override_param_file]) + ]) \ No newline at end of file From 976efa6adbc02671cb1d2c5e85b7fd1aca2a6025 Mon Sep 17 00:00:00 2001 From: Anish_deva <51463994+adev4a@users.noreply.github.com> Date: Fri, 22 Nov 2024 17:07:44 -0500 Subject: [PATCH 4/6] Fix ros2bag launch (#243) # PR Details This PR fixes an issue in the carma-messenger launch script causing the ros2 rosbag recording to error out. The ThisLaunchFileDir() option being placed after get_package_share_directory calls causes ThisLaunchFileDir() substitution to take the value of the last get_package_share_directory(). In this update the ros2 rosbag record launch option was moved to the start of the script as a workaround. Additionally the required config directory from the carma-messenger package was added to installation. ## Description ## Related GitHub Issue ## Related Jira Key ## Motivation and Context ## How Has This Been Tested? ## Types of changes - [x] Defect fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that cause existing functionality to change) ## Checklist: - [ ] I have added any new packages to the sonar-scanner.properties file - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [x] I have read the [**CONTRIBUTING**](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md) document. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. --- .../carma-messenger/CMakeLists.txt | 3 +-- .../launch/carma-messenger.launch.py | 22 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/carma-messenger-core/carma-messenger/CMakeLists.txt b/carma-messenger-core/carma-messenger/CMakeLists.txt index 5b86878e..f9aae592 100644 --- a/carma-messenger-core/carma-messenger/CMakeLists.txt +++ b/carma-messenger-core/carma-messenger/CMakeLists.txt @@ -52,8 +52,7 @@ else() # ROS 2 ament_auto_package( - INSTALL_TO_SHARE launch log-config scripts ui + INSTALL_TO_SHARE config launch log-config scripts ui ) endif() - diff --git a/carma-messenger-core/carma-messenger/launch/carma-messenger.launch.py b/carma-messenger-core/carma-messenger/launch/carma-messenger.launch.py index 5be48272..f3f7f9fe 100644 --- a/carma-messenger-core/carma-messenger/launch/carma-messenger.launch.py +++ b/carma-messenger-core/carma-messenger/launch/carma-messenger.launch.py @@ -45,6 +45,15 @@ def generate_launch_description(): description = 'Path of folder on host PC containing route CSV file(s) that can be accessed by plugins' ) + # Launch ROS2 rosbag logging + ros2_rosbag_launch = GroupAction( + actions=[ + IncludeLaunchDescription( + PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/ros2_rosbag.launch.py']), + ) + ] + ) + transform_group = GroupAction( actions=[ PushRosNamespace(EnvironmentVariable('CARMA_TF_NS', default_value='/')), @@ -94,23 +103,14 @@ def generate_launch_description(): ) - # Launch ROS2 rosbag logging - ros2_rosbag_launch = GroupAction( - actions=[ - IncludeLaunchDescription( - PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/ros2_rosbag.launch.py']), - ) - ] - ) - return LaunchDescription([ declare_configuration_delay_arg, declare_route_file_folder, + ros2_rosbag_launch, transform_group, v2x_group, plugins_group, ui_group, - traffic_incident_group, - ros2_rosbag_launch + traffic_incident_group ]) From 57087a4e2c6d32be93e8d53f417e953e45f0223f Mon Sep 17 00:00:00 2001 From: Saikrishna Bairamoni <84093461+SaikrishnaBairamoni@users.noreply.github.com> Date: Tue, 26 Nov 2024 13:40:14 -0500 Subject: [PATCH 5/6] Auto Merge develop to develop-humble (#244) # PR Details This PR introduces a workflow auto-merge-workflow.yml to handle the auto merging of develop changes into develop humble branch weekly and send notification to DevOps team when there are merge conflicts. This workflow uses reusable actions merge-develop-humble.yml. ## Description ## Related GitHub Issue ## Related Jira Key [ARC-247](https://usdot-carma.atlassian.net/browse/ARC-247) ## Motivation and Context ## How Has This Been Tested? ## Types of changes - [ ] Defect fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that cause existing functionality to change) ## Checklist: - [ ] I have added any new packages to the sonar-scanner.properties file - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I have read the [**CONTRIBUTING**](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md) document. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. [ARC-247]: https://usdot-carma.atlassian.net/browse/ARC-247?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- .github/workflows/auto-merge-workflow.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/auto-merge-workflow.yml diff --git a/.github/workflows/auto-merge-workflow.yml b/.github/workflows/auto-merge-workflow.yml new file mode 100644 index 00000000..b071183c --- /dev/null +++ b/.github/workflows/auto-merge-workflow.yml @@ -0,0 +1,14 @@ +name: Auto Merge develop to develop-humble + +on: + schedule: + - cron: '0 0 * * 1' # Weekly on Monday + workflow_dispatch: + +jobs: + call-merge-workflow: + uses: usdot-fhwa-stol/actions/.github/workflows/auto-pr-merge.yml@main + with: + branch_from: develop + branch_to: develop-humble + notify_team: DevOps From 4fc1479967514e9b5a1b6c374cc6ab3b11c10e95 Mon Sep 17 00:00:00 2001 From: Anish_deva <51463994+adev4a@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:50:42 -0500 Subject: [PATCH 6/6] update parameter filter for traffic incident plugin (#245) # PR Details This PR updates the filter for traffic incident plugin to not check for minimum gap values since that parameter is not used and checks for the other parameters as an or condition. Since stop_broadcast service call is resets all parameters to zero - this "or " condition should result in the desired response. ## Description ## Related GitHub Issue ## Related Jira Key ## Motivation and Context ## How Has This Been Tested? ## Types of changes - [x] Defect fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that cause existing functionality to change) ## Checklist: - [ ] I have added any new packages to the sonar-scanner.properties file - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [x] I have read the [**CONTRIBUTING**](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md) document. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. --- .../traffic_incident/include/traffic_incident_node.hpp | 1 + .../traffic_incident/src/traffic_incident_node.cpp | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/carma-messenger-core/traffic_incident/include/traffic_incident_node.hpp b/carma-messenger-core/traffic_incident/include/traffic_incident_node.hpp index ecb46179..743fd902 100644 --- a/carma-messenger-core/traffic_incident/include/traffic_incident_node.hpp +++ b/carma-messenger-core/traffic_incident/include/traffic_incident_node.hpp @@ -86,6 +86,7 @@ class TrafficIncidentNode : public carma_ros2_utils::CarmaLifecycleNode double down_track_; double up_track_; double min_gap_; + static constexpr double epsilon_ = 1e-6; }; } // namespace traffic diff --git a/carma-messenger-core/traffic_incident/src/traffic_incident_node.cpp b/carma-messenger-core/traffic_incident/src/traffic_incident_node.cpp index aecc4eb9..596ac978 100644 --- a/carma-messenger-core/traffic_incident/src/traffic_incident_node.cpp +++ b/carma-messenger-core/traffic_incident/src/traffic_incident_node.cpp @@ -150,8 +150,7 @@ bool TrafficIncidentNode::stopTrafficBroadcastCallback( void TrafficIncidentNode::spin_callback(void) { if ( - traffic_worker_.getDownTrack() > 0 && traffic_worker_.getUpTrack() > 0 && - traffic_worker_.getMinGap() > 0 && traffic_worker_.getAdvisorySpeed() > 0) { + std::fabs(traffic_worker_.getDownTrack()) > epsilon_ || std::fabs(traffic_worker_.getUpTrack() > epsilon_) || std::fabs(traffic_worker_.getAdvisorySpeed() > epsilon_)) { // construct local mobilityOperation msg carma_v2x_msgs::msg::MobilityOperation traffic_mobility_msg = traffic_worker_.mobilityMessageGenerator(traffic_worker_.getPinPoint());