How to send two (or more) launch file to different RViz panel at the same time

asked 2019-06-18 05:15:29 -0500

RayROS gravatar image

Hello, I sub-classed RViz according to the following directions. On my project I created N.2 different types of .launch files for N.2 different filters, and I wanted to launch the two filters at the same time. As it possible to see from the image below I was able to creat n.2 RViz renderer:

renderer

As stated here, the tag enables you to import another roslaunch XML file into the current project folder. It will be imported within the current scope of my projects including all tags.

<?xml version="1.0"?>
<launch>

<!--Below launch files work, but I can't address them to the proper visualizer-->
<include file="$(find ros_float)/pf_launch/pf.launch" />
<include file="$(find ros_float)/pf_launch/pf_first_order.launch" />

</launch>

However I run into the following problem: How to send each .launch file above to the different rviz::RenderPanel()?

If I run the .launch file above ( so the two XML files at the same time as I am hoping to do), I run into the following error:

RLException: roslaunch file contains multiple nodes named [/unc_preprocessor]. Please check all <node> 'name' attributes to make sure they are unique. Also check that $(anon id) use different ids. The traceback for the exception was written to the log file

But if I run them separately, my custom RViz visualizer is by-passed using the usual RViz panel

For completeness I am including part of the most important code that creates the rviz::RenderPanel() and as you can see I named:

1) render_panel = new rviz::RenderPanel();

2) render_panel2 = new rviz::RenderPanel();

See code belolw:

MyViz::MyViz(QWidget *parent) : QWidget(parent)
{
 // Setting up constructor....

    // construct lay-out and render panels next to each other
    render_panel = new rviz::RenderPanel();
    render_panel2 = new rviz::RenderPanel();
    control_layout->addWidget(render_panel,  2, 0, 1, 2);
    control_layout->addWidget(render_panel2, 2, 2, 1, 2);
    setLayout(control_layout);

    manager = new rviz::VisualizationManager(render_panel);
    render_panel->initialize(manager->getSceneManager(), manager);
    manager->initialize();
    manager->startUpdate();

    manager2 = new rviz::VisualizationManager(render_panel2);
    render_panel2->initialize(manager2->getSceneManager(), manager2);
    manager2->initialize();
    manager2->startUpdate();

    // other operations such as:

    // create grid

    // configure the grid display
}

Thanks for shedding light on this issue and point to the right direction.

edit retag flag offensive close merge delete