ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

RVIZ how to pass in parameter in launch file

asked 2022-11-15 22:30:55 -0600

ziranshu gravatar image

I am trying to write a launch file that automate my visualization process, the idea is to take a msg.Image topic name as argument and launch RVIZ to launch a image panel for that topic:

def generate_launch_description():
    sensor_topic_arg = DeclareLaunchArgument(
        'sensor_topic',
        default_value='/test_sensor'
    )
    ld = launch.LaunchDescription([
        sensor_topic_arg
    ])
    ld.add_action(
        Node(
            package='rviz2',
            executable='rviz2',
        )
    )
    return ld

How can I pass the image topic to RVIZ as an argument, so that the RVIZ will be able to show the topic on an image panel on launch.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-11-17 04:44:42 -0600

ravijoshi gravatar image

How can I pass the image topic to RVIZ as an argument, so that the RVIZ will be able to show the topic on an image panel on launch.

You don't do that. Instead, you should save the RViz config in a config file. Next time, while invoking RViz, please provide the complete path to that .rviz file. For example, please see the code snippet below, in which rviz_config_file variable holds the absolute path to the .rviz file.

# Open RViz
rviz_node = Node(
    package='rviz2',
    executable='rviz2',
    name='image_demo_rviz',
    arguments=['-d', rviz_config_file]
)
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-11-15 22:30:55 -0600

Seen: 637 times

Last updated: Nov 17 '22