Skip to content
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

feat: allow remapping of can_fd topics via launch file #52

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 7 additions & 3 deletions ros2_socketcan/launch/socket_can_receiver.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 7 additions & 3 deletions ros2_socketcan/launch/socket_can_sender.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
Loading