From f7a9acea10518a8f4c8df9b85a38402e1c448ffd Mon Sep 17 00:00:00 2001 From: Chris Iverach-Brereton Date: Tue, 2 Sep 2025 12:49:31 -0400 Subject: [PATCH 1/3] Remap the diagnostic output of the oakd node when using a namespace --- turtlebot4_bringup/launch/oakd.launch.py | 44 ++++++++++++++---------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/turtlebot4_bringup/launch/oakd.launch.py b/turtlebot4_bringup/launch/oakd.launch.py index 859ead3..50df31f 100644 --- a/turtlebot4_bringup/launch/oakd.launch.py +++ b/turtlebot4_bringup/launch/oakd.launch.py @@ -18,22 +18,19 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument, GroupAction +from launch.actions import DeclareLaunchArgument, GroupAction, OpaqueFunction from launch.substitutions import LaunchConfiguration, PathJoinSubstitution -from launch_ros.actions import ComposableNodeContainer, PushRosNamespace +from launch_ros.actions import ComposableNodeContainer, PushRosNamespace, SetRemap from launch_ros.descriptions import ComposableNode from nav2_common.launch import RewrittenYaml -def generate_launch_description(): - pkg_turtlebot4_bringup = get_package_share_directory('turtlebot4_bringup') - - camera = LaunchConfiguration('camera') - params_file = LaunchConfiguration('params_file') - namespace = LaunchConfiguration('namespace') - - ARGUMENTS = [ +pkg_turtlebot4_bringup = get_package_share_directory('turtlebot4_bringup') +camera = LaunchConfiguration('camera') +params_file = LaunchConfiguration('params_file') +namespace = LaunchConfiguration('namespace') +ARGUMENTS = [ DeclareLaunchArgument('camera', default_value='oakd_pro'), DeclareLaunchArgument('params_file', default_value=[PathJoinSubstitution( @@ -42,13 +39,23 @@ def generate_launch_description(): description='Robot namespace') ] + +def launch_setup(context, *args, **kwargs): + namespace_str = namespace.perform(context) + if (namespace_str and not namespace_str.startswith('/')): + namespace_str = '/' + namespace_str + namespaced_param_file = RewrittenYaml( source_file=params_file, root_key=namespace, param_rewrites={}, - convert_types=True) + convert_types=True, + ) - node = ComposableNodeContainer( + oakd = GroupAction([ + PushRosNamespace(namespace), + SetRemap('/diagnostics', namespace_str + '/diagnostics'), + ComposableNodeContainer( name='oakd_container', namespace=namespace, package='rclcpp_components', @@ -63,13 +70,12 @@ def generate_launch_description(): ], output='screen', ) + ]) - actions = [ - PushRosNamespace(namespace), - node - ] - oakd = GroupAction(actions) + return [oakd] + +def generate_launch_description(): ld = LaunchDescription(ARGUMENTS) - ld.add_action(oakd) - return ld + ld.add_action(OpaqueFunction(function=launch_setup)) + return ld \ No newline at end of file From bb56badfbbe70be0916fca4ca272b24e1d2751ad Mon Sep 17 00:00:00 2001 From: Chris Iverach-Brereton Date: Tue, 2 Sep 2025 13:15:46 -0400 Subject: [PATCH 2/3] Add newline at EOF --- turtlebot4_bringup/launch/oakd.launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/turtlebot4_bringup/launch/oakd.launch.py b/turtlebot4_bringup/launch/oakd.launch.py index 50df31f..a8bf303 100644 --- a/turtlebot4_bringup/launch/oakd.launch.py +++ b/turtlebot4_bringup/launch/oakd.launch.py @@ -78,4 +78,4 @@ def launch_setup(context, *args, **kwargs): def generate_launch_description(): ld = LaunchDescription(ARGUMENTS) ld.add_action(OpaqueFunction(function=launch_setup)) - return ld \ No newline at end of file + return ld From 487135d678f66d8dbdca1136e6504caaa1caa21b Mon Sep 17 00:00:00 2001 From: Chris Iverach-Brereton Date: Tue, 2 Sep 2025 13:28:33 -0400 Subject: [PATCH 3/3] Fix import ordering in ros_tests --- turtlebot4_tests/turtlebot4_tests/ros_tests.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/turtlebot4_tests/turtlebot4_tests/ros_tests.py b/turtlebot4_tests/turtlebot4_tests/ros_tests.py index 60dbe46..9e385f4 100644 --- a/turtlebot4_tests/turtlebot4_tests/ros_tests.py +++ b/turtlebot4_tests/turtlebot4_tests/ros_tests.py @@ -34,6 +34,7 @@ from irobot_create_msgs.action import Dock, DriveDistance, RotateAngle, Undock from irobot_create_msgs.msg import DockStatus, InterfaceButtons, LightringLeds +from irobot_create_msgs.srv import EStop from nav_msgs.msg import Odometry @@ -42,8 +43,6 @@ from rclpy.node import Node from rclpy.qos import qos_profile_sensor_data -from irobot_create_msgs.srv import EStop - from std_msgs.msg import String from turtlebot4_msgs.msg import UserButton, UserLed