Skip to content
Snippets Groups Projects
Unverified Commit cd239d60 authored by Carlos A. Orduno's avatar Carlos A. Orduno Committed by GitHub
Browse files

Launch RVIZ using launch_ros::Actions::Node (#1286)

parent ec4904be
Branches
No related tags found
No related merge requests found
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
import os import os
from ament_index_python.packages import get_package_prefix, get_package_share_directory from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription from launch import LaunchDescription
from launch.actions import (DeclareLaunchArgument, EmitEvent, ExecuteProcess, from launch.actions import (DeclareLaunchArgument, EmitEvent, ExecuteProcess,
...@@ -152,37 +152,19 @@ def generate_launch_description(): ...@@ -152,37 +152,19 @@ def generate_launch_description():
remappings=remappings, remappings=remappings,
arguments=[urdf]) arguments=[urdf])
# TODO(orduno) RVIZ crashing if launched as a node: https://github.com/ros2/rviz/issues/442 start_rviz_cmd = Node(
# Launching as node works after applying the change described on the github issue.
# Once fixed, launch by providing the remappings:
# rviz_remappings = [('/tf', 'tf'),
# ('/tf_static', 'tf_static'),
# ('goal_pose', 'goal_pose'),
# ('/clicked_point', 'clicked_point'),
# ('/initialpose', 'initialpose'),
# ('/parameter_events', 'parameter_events'),
# ('/rosout', 'rosout')]
# start_rviz_cmd = Node(
# package='rviz2',
# node_executable='rviz2',
# node_name='rviz2',
# arguments=['-d', rviz_config_file],
# output='screen',
# use_remappings=IfCondition(use_remappings),
# remappings=rviz_remappings)
start_rviz_cmd = ExecuteProcess(
condition=IfCondition(use_rviz), condition=IfCondition(use_rviz),
cmd=[os.path.join(get_package_prefix('rviz2'), 'lib/rviz2/rviz2'), package='rviz2',
['-d', rviz_config_file], node_executable='rviz2',
['__ns:=/', namespace], node_name='rviz2',
'/tf:=tf', arguments=['-d', rviz_config_file],
'/tf_static:=tf_static', output='screen',
'/goal_pose:=goal_pose', use_remappings=IfCondition(use_remappings),
'/clicked_point:=clicked_point', remappings=[('/tf', 'tf'),
'/initialpose:=initialpose'], ('/tf_static', 'tf_static'),
cwd=[launch_dir], output='screen') ('goal_pose', 'goal_pose'),
('/clicked_point', 'clicked_point'),
('/initialpose', 'initialpose')])
exit_event_handler = RegisterEventHandler( exit_event_handler = RegisterEventHandler(
event_handler=OnProcessExit( event_handler=OnProcessExit(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment