Skip to content

Commit cd239d6

Browse files
authoredOct 28, 2019
Launch RVIZ using launch_ros::Actions::Node (ros-navigation#1286)
1 parent ec4904b commit cd239d6

File tree

1 file changed

+13
-31
lines changed

1 file changed

+13
-31
lines changed
 

‎nav2_bringup/bringup/launch/nav2_tb3_simulation_launch.py

+13-31
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import os
1818

19-
from ament_index_python.packages import get_package_prefix, get_package_share_directory
19+
from ament_index_python.packages import get_package_share_directory
2020

2121
from launch import LaunchDescription
2222
from launch.actions import (DeclareLaunchArgument, EmitEvent, ExecuteProcess,
@@ -152,37 +152,19 @@ def generate_launch_description():
152152
remappings=remappings,
153153
arguments=[urdf])
154154

155-
# TODO(orduno) RVIZ crashing if launched as a node: https://github.com/ros2/rviz/issues/442
156-
# Launching as node works after applying the change described on the github issue.
157-
# Once fixed, launch by providing the remappings:
158-
# rviz_remappings = [('/tf', 'tf'),
159-
# ('/tf_static', 'tf_static'),
160-
# ('goal_pose', 'goal_pose'),
161-
# ('/clicked_point', 'clicked_point'),
162-
# ('/initialpose', 'initialpose'),
163-
# ('/parameter_events', 'parameter_events'),
164-
# ('/rosout', 'rosout')]
165-
166-
# start_rviz_cmd = Node(
167-
# package='rviz2',
168-
# node_executable='rviz2',
169-
# node_name='rviz2',
170-
# arguments=['-d', rviz_config_file],
171-
# output='screen',
172-
# use_remappings=IfCondition(use_remappings),
173-
# remappings=rviz_remappings)
174-
175-
start_rviz_cmd = ExecuteProcess(
155+
start_rviz_cmd = Node(
176156
condition=IfCondition(use_rviz),
177-
cmd=[os.path.join(get_package_prefix('rviz2'), 'lib/rviz2/rviz2'),
178-
['-d', rviz_config_file],
179-
['__ns:=/', namespace],
180-
'/tf:=tf',
181-
'/tf_static:=tf_static',
182-
'/goal_pose:=goal_pose',
183-
'/clicked_point:=clicked_point',
184-
'/initialpose:=initialpose'],
185-
cwd=[launch_dir], output='screen')
157+
package='rviz2',
158+
node_executable='rviz2',
159+
node_name='rviz2',
160+
arguments=['-d', rviz_config_file],
161+
output='screen',
162+
use_remappings=IfCondition(use_remappings),
163+
remappings=[('/tf', 'tf'),
164+
('/tf_static', 'tf_static'),
165+
('goal_pose', 'goal_pose'),
166+
('/clicked_point', 'clicked_point'),
167+
('/initialpose', 'initialpose')])
186168

187169
exit_event_handler = RegisterEventHandler(
188170
event_handler=OnProcessExit(

0 commit comments

Comments
 (0)
Please sign in to comment.