Skip to content

rviz2 crashes when launched as a node #442

@rotu

Description

@rotu

When launching using a launch_ros.actions.Node, RViz2 crashes, choking on the newly introduced --ros-args option. Seems to be caused by ros2/launch_ros#52

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'].

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions