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

Visualize two different pointclouds (PointCloud2) in separate views of rviz2

asked 2022-06-10 06:54:42 -0600

fabbro gravatar image

I have two different pointclouds (PointCloud2 topics) that I would like to visualize in two separate views in rviz2.

What options do I have?

So far the only viable one seems to be to run two instances of rviz2.

Thanks for your help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-06-10 10:45:33 -0600

fabbro gravatar image

In the end, I solved the problem. I used a launch file to open several instances of ROS2 and it works quite well, to be honest.

In order to have different instances you can have a launch file like this:

import os

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
    config_camera_1 = "config_1.rviz"
    config_camera_2 = "config_2.rviz"
    config_lidar_1 = "config_3.rviz"
    config_lidar_2 = "config_4.rviz"
    config_lidar_3 = "config_5.rviz"

    print("SHARE_dir: ", get_package_share_directory('offline_sensor_data_server'))

    return LaunchDescription([
        Node(package='rviz2',
            executable='rviz2',
            name='rviz2_camera_1',
            arguments=['-d', config_camera_1],
            output='screen'
        ),
        Node(package='rviz2',
            executable='rviz2',
            name='rviz2_camera_2',
            arguments=['-d', config_camera_2],
            output='screen'
        ),
        Node(package='rviz2',
            executable='rviz2',
            name='rviz2_2',
            arguments=['-d', config_lidar_1],
            output='screen'
        ),
        Node(package='rviz2',
            executable='rviz2',
            name='rviz2_3',
            arguments=['-d', config_lidar_2],
            output='screen'
        ),
        Node(package='rviz2',
            executable='rviz2',
            name='rviz2_4',
            arguments=['-d', config_lidar_3],
            output='screen'
        ),
    ])

I hope it helps someone in the same situation.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-06-10 06:54:42 -0600

Seen: 191 times

Last updated: Jun 10 '22