Skip to content

Commit 7c11b8c

Browse files
iamnambiarSteveMacenski
authored andcommitted
Refractor: Use predefined variable for consistency in the tb4 launch files (#25)
Signed-off-by: Neeraj C <neeraj.cnambiar@gmail.com>
1 parent 9b0581f commit 7c11b8c

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

nav2_minimal_tb4_description/launch/robot_description.launch.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def generate_launch_description():
4343
rviz_config_file = PathJoinSubstitution([pkg_turtlebot4_description, 'rviz', 'config.rviz'])
4444
namespace = LaunchConfiguration('namespace')
4545

46+
remappings = [('/tf', 'tf'), ('/tf_static', 'tf_static')]
47+
4648
robot_state_publisher = Node(
4749
package='robot_state_publisher',
4850
executable='robot_state_publisher',
@@ -53,10 +55,7 @@ def generate_launch_description():
5355
{'robot_description': Command(['xacro', ' ', xacro_file,
5456
' ', 'namespace:=', namespace])},
5557
],
56-
remappings=[
57-
('/tf', 'tf'),
58-
('/tf_static', 'tf_static')
59-
]
58+
remappings=remappings
6059
)
6160

6261
joint_state_publisher = Node(
@@ -65,10 +64,7 @@ def generate_launch_description():
6564
name='joint_state_publisher',
6665
output='screen',
6766
parameters=[{'use_sim_time': LaunchConfiguration('use_sim_time')}],
68-
remappings=[
69-
('/tf', 'tf'),
70-
('/tf_static', 'tf_static')
71-
]
67+
remappings=remappings
7268
)
7369

7470
rviz2 = Node(
@@ -78,10 +74,7 @@ def generate_launch_description():
7874
output='screen',
7975
arguments=['-d', rviz_config_file],
8076
parameters=[{'use_sim_time': LaunchConfiguration('use_sim_time')}],
81-
remappings=[
82-
('/tf', 'tf'),
83-
('/tf_static', 'tf_static')
84-
],
77+
remappings=remappings,
8578
)
8679

8780
ld = LaunchDescription(ARGUMENTS)

nav2_minimal_tb4_sim/launch/simulation.launch.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,7 @@ def generate_launch_description():
151151
output='screen',
152152
arguments=['-d', rviz_config_file],
153153
parameters=[{'use_sim_time': use_sim_time}],
154-
remappings=[
155-
('/tf', 'tf'),
156-
('/tf_static', 'tf_static')
157-
],
154+
remappings=remappings,
158155
)
159156

160157
# The SDF file for the world is a xacro file because we wanted to

0 commit comments

Comments
 (0)