From 63df2854470e0e567f5698c45c6a5f949b49a306 Mon Sep 17 00:00:00 2001 From: Nikhil Date: Tue, 1 Oct 2024 08:13:53 +0200 Subject: [PATCH] launch control file arg (#196) --- .../launch/robot_description.launch.py | 10 +++++++++- .../gazebo/tb4_sim_scenario/urdf/create3.urdf.xacro | 7 +++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/simulation/gazebo/tb4_sim_scenario/launch/robot_description.launch.py b/simulation/gazebo/tb4_sim_scenario/launch/robot_description.launch.py index 9cefb694..b70b700a 100644 --- a/simulation/gazebo/tb4_sim_scenario/launch/robot_description.launch.py +++ b/simulation/gazebo/tb4_sim_scenario/launch/robot_description.launch.py @@ -16,6 +16,7 @@ # @author Roni Kreinin (rkreinin@clearpathrobotics.com) +import os from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription @@ -37,6 +38,11 @@ description='Robot name'), DeclareLaunchArgument('namespace', default_value=LaunchConfiguration('robot_name'), description='Robot namespace'), + DeclareLaunchArgument( + 'control_config', + default_value=os.path.join(get_package_share_directory("irobot_create_control"), 'config', 'control.yaml'), + description='Path to the control YAML file.' + ) ] @@ -46,6 +52,7 @@ def generate_launch_description(): 'urdf', 'turtlebot4.urdf.xacro']) namespace = LaunchConfiguration('namespace') + control_config = LaunchConfiguration('control_config') robot_state_publisher = Node( package='robot_state_publisher', @@ -57,7 +64,8 @@ def generate_launch_description(): {'robot_description': ParameterValue(Command([ 'xacro', ' ', xacro_file, ' ', 'gazebo:=ignition', ' ', - 'namespace:=', namespace]), value_type=str)}, + 'namespace:=', namespace, ' ', + 'control_config:=', control_config]), value_type=str)}, ], remappings=[ ('/tf', 'tf'), diff --git a/simulation/gazebo/tb4_sim_scenario/urdf/create3.urdf.xacro b/simulation/gazebo/tb4_sim_scenario/urdf/create3.urdf.xacro index 34dd4cc6..d5428ed4 100644 --- a/simulation/gazebo/tb4_sim_scenario/urdf/create3.urdf.xacro +++ b/simulation/gazebo/tb4_sim_scenario/urdf/create3.urdf.xacro @@ -34,6 +34,9 @@ SPDX-License-Identifier: Apache-2.0 --> + + + @@ -137,7 +140,7 @@ SPDX-License-Identifier: Apache-2.0 --> - $(find irobot_create_control)/config/control.yaml + $(arg control_config) ~/odom:=odom /tf:=tf @@ -152,7 +155,7 @@ SPDX-License-Identifier: Apache-2.0 --> - $(find irobot_create_control)/config/control.yaml + $(arg control_config) ~/odom:=odom /tf:=tf