from pathlib import Path
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import SetEnvironmentVariable, DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
def generate_launch_description():
rviz_config = Path(get_package_share_directory('openrover_demo'), 'config', 'default.rviz').resolve()
assert rviz_config.is_file()
return LaunchDescription([
DeclareLaunchArgument('frame', default_value='map', description='The fixed frame to be used in RViz'),
SetEnvironmentVariable('RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED', '1'),
Node(
package='rviz2', node_executable='rviz2', output='screen',
arguments=[
'--display-config', str(rviz_config),
'--fixed-frame', LaunchConfiguration(variable_name='frame')
]
)
])
$ ros2 launch openrover_demo rviz.launch.py
[INFO] [launch]: All log files can be found below /home/dan/.ros/log/2019-08-07-14-17-41-837727-rhea-5588
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [rviz2-1]: process started with pid [6352]
[rviz2-1] Unknown option 'ros-args'.
[ERROR] [rviz2-1]: process has died [pid 6352, exit code 1, cmd '/home/dan/ros2_ws/install/lib/rviz2/rviz2 --display-config /home/dan/ros2_ws/install/share/openrover_demo/config/default.rviz --fixed-frame map --ros-args'].
When launching using a
launch_ros.actions.Node, RViz2 crashes, choking on the newly introduced--ros-argsoption. Seems to be caused by ros2/launch_ros#52