From 80c670ffc63e5cee924211591ee63bb943976894 Mon Sep 17 00:00:00 2001 From: FranzMatze Date: Tue, 30 Jul 2024 17:16:53 +0200 Subject: [PATCH 1/2] Allow remapping of can_fd topics via launch file Signed-off-by: Franz Albers --- ros2_socketcan/launch/socket_can_receiver.launch.py | 10 +++++++--- ros2_socketcan/launch/socket_can_sender.launch.py | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ros2_socketcan/launch/socket_can_receiver.launch.py b/ros2_socketcan/launch/socket_can_receiver.launch.py index 080541c..711b7a5 100644 --- a/ros2_socketcan/launch/socket_can_receiver.launch.py +++ b/ros2_socketcan/launch/socket_can_receiver.launch.py @@ -18,7 +18,7 @@ from launch import LaunchDescription from launch.actions import (DeclareLaunchArgument, EmitEvent, RegisterEventHandler) -from launch.conditions import IfCondition +from launch.conditions import IfCondition, UnlessCondition from launch.event_handlers import OnProcessStart from launch.events import matches_action from launch.substitutions import LaunchConfiguration, TextSubstitution @@ -42,7 +42,8 @@ def generate_launch_description(): 'filters': LaunchConfiguration('filters'), 'use_bus_time': LaunchConfiguration('use_bus_time'), }], - remappings=[('from_can_bus', LaunchConfiguration('from_can_bus_topic'))], + remappings=[('from_can_bus', LaunchConfiguration('from_can_bus_topic')), + ('from_can_bus_fd', LaunchConfiguration('from_can_bus_topic'))], output='screen') socket_can_receiver_configure_event_handler = RegisterEventHandler( @@ -107,7 +108,10 @@ def generate_launch_description(): 'man1/candump.1.html'), DeclareLaunchArgument('auto_configure', default_value='true'), DeclareLaunchArgument('auto_activate', default_value='true'), - DeclareLaunchArgument('from_can_bus_topic', default_value='from_can_bus'), + DeclareLaunchArgument('from_can_bus_topic', default_value='from_can_bus_fd', + condition=IfCondition(LaunchConfiguration('enable_can_fd'))), + DeclareLaunchArgument('from_can_bus_topic', default_value='from_can_bus', + condition=UnlessCondition(LaunchConfiguration('enable_can_fd'))), socket_can_receiver_node, socket_can_receiver_configure_event_handler, socket_can_receiver_activate_event_handler, diff --git a/ros2_socketcan/launch/socket_can_sender.launch.py b/ros2_socketcan/launch/socket_can_sender.launch.py index 39829de..f229df0 100644 --- a/ros2_socketcan/launch/socket_can_sender.launch.py +++ b/ros2_socketcan/launch/socket_can_sender.launch.py @@ -18,7 +18,7 @@ from launch import LaunchDescription from launch.actions import (DeclareLaunchArgument, EmitEvent, RegisterEventHandler) -from launch.conditions import IfCondition +from launch.conditions import IfCondition, UnlessCondition from launch.event_handlers import OnProcessStart from launch.events import matches_action from launch.substitutions import LaunchConfiguration, TextSubstitution @@ -40,7 +40,8 @@ def generate_launch_description(): 'timeout_sec': LaunchConfiguration('timeout_sec'), }], - remappings=[('to_can_bus', LaunchConfiguration('to_can_bus_topic'))], + remappings=[('to_can_bus', LaunchConfiguration('to_can_bus_topic')), + ('to_can_bus_fd', LaunchConfiguration('to_can_bus_topic'))], output='screen') socket_can_sender_configure_event_handler = RegisterEventHandler( @@ -81,7 +82,10 @@ def generate_launch_description(): DeclareLaunchArgument('timeout_sec', default_value='0.01'), DeclareLaunchArgument('auto_configure', default_value='true'), DeclareLaunchArgument('auto_activate', default_value='true'), - DeclareLaunchArgument('to_can_bus_topic', default_value='to_can_bus'), + DeclareLaunchArgument('to_can_bus_topic', default_value='to_can_bus_fd', + condition=IfCondition(LaunchConfiguration('enable_can_fd'))), + DeclareLaunchArgument('to_can_bus_topic', default_value='to_can_bus', + condition=UnlessCondition(LaunchConfiguration('enable_can_fd'))), socket_can_sender_node, socket_can_sender_configure_event_handler, socket_can_sender_activate_event_handler, From 0484da379464ea126af5e8e3957b0cdeb80c8c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Wed, 4 Dec 2024 21:50:27 +0300 Subject: [PATCH 2/2] remove trailing whitespaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- ros2_socketcan/launch/socket_can_receiver.launch.py | 4 ++-- ros2_socketcan/launch/socket_can_sender.launch.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ros2_socketcan/launch/socket_can_receiver.launch.py b/ros2_socketcan/launch/socket_can_receiver.launch.py index 711b7a5..2c411d0 100644 --- a/ros2_socketcan/launch/socket_can_receiver.launch.py +++ b/ros2_socketcan/launch/socket_can_receiver.launch.py @@ -108,9 +108,9 @@ def generate_launch_description(): 'man1/candump.1.html'), DeclareLaunchArgument('auto_configure', default_value='true'), DeclareLaunchArgument('auto_activate', default_value='true'), - DeclareLaunchArgument('from_can_bus_topic', default_value='from_can_bus_fd', + DeclareLaunchArgument('from_can_bus_topic', default_value='from_can_bus_fd', condition=IfCondition(LaunchConfiguration('enable_can_fd'))), - DeclareLaunchArgument('from_can_bus_topic', default_value='from_can_bus', + DeclareLaunchArgument('from_can_bus_topic', default_value='from_can_bus', condition=UnlessCondition(LaunchConfiguration('enable_can_fd'))), socket_can_receiver_node, socket_can_receiver_configure_event_handler, diff --git a/ros2_socketcan/launch/socket_can_sender.launch.py b/ros2_socketcan/launch/socket_can_sender.launch.py index f229df0..e72c228 100644 --- a/ros2_socketcan/launch/socket_can_sender.launch.py +++ b/ros2_socketcan/launch/socket_can_sender.launch.py @@ -82,9 +82,9 @@ def generate_launch_description(): DeclareLaunchArgument('timeout_sec', default_value='0.01'), DeclareLaunchArgument('auto_configure', default_value='true'), DeclareLaunchArgument('auto_activate', default_value='true'), - DeclareLaunchArgument('to_can_bus_topic', default_value='to_can_bus_fd', + DeclareLaunchArgument('to_can_bus_topic', default_value='to_can_bus_fd', condition=IfCondition(LaunchConfiguration('enable_can_fd'))), - DeclareLaunchArgument('to_can_bus_topic', default_value='to_can_bus', + DeclareLaunchArgument('to_can_bus_topic', default_value='to_can_bus', condition=UnlessCondition(LaunchConfiguration('enable_can_fd'))), socket_can_sender_node, socket_can_sender_configure_event_handler,