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

Rviz open panel through plugin tool

asked 2016-07-29 00:50:11 -0600

ms0719584 gravatar image

Hi,

I am currently developing a rviz plugin tool (myTool, inherited from rviz::Tool) and a rviz panel (myPanel, inherited from rviz::Panel). They come together, so I want to open myPanel as soon as myTool is added to the tool bar in rviz. But I couldn't find a way to do it.

I am able to achieve the reverse. i.e. when I add myPanel through menu option in rviz, myTool is automatically added into the tool bar in rviz. This is done by the following code in myPanel.cpp

vis_manager_->getToolManager()->addTool("myTool");

It would be nice if there is a similar way to open myPanel through code in myTool.cpp.

Or maybe there's a more elegant way to do this?

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-08-01 20:20:34 -0600

William gravatar image

The vis_manager_ has the addPanelByName function, see:

https://github.com/ros-visualization/...

You'd have to figure out how to get the parameters, maybe look to the openNewPanelDialog function and the NewObjectDialog class for those:

https://github.com/ros-visualization/...

https://github.com/ros-visualization/...

Sorry I couldn't be more specific, but I've never tried to do what you've described. I hope you find a way that works for sure.

edit flag offensive delete link more

Comments

vis_manager_ doesn't have addPanelByName. This member function is in rviz::VisualizationFrame. But I could only get its parent class rviz::WindowManagerInterface through vis_manager->getWindowManager(). I couldn't find any function that returns rviz::VisualizationManager.

ms0719584 gravatar image ms0719584  ( 2016-08-02 09:16:06 -0600 )edit

Hmm, you're right, I got those two mixed up. It might not be possible as-is. I'm sorry I don't have time to work something out for you, but if you find a way to do it, or have an idea of how it could be better organized, please open an issue on rviz.

William gravatar image William  ( 2016-08-08 22:52:38 -0600 )edit

I find out I can get rviz::VisualizationFrame through casting: (rviz::VisualizationFrame*) vis_manager->getWindowManager(), but now the problem is addPanelByName is protected, so I cannot access it. There is a public function addPane, but it seems to create a empty panel,not an exiting one.

ms0719584 gravatar image ms0719584  ( 2016-08-08 23:22:25 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-07-29 00:50:11 -0600

Seen: 513 times

Last updated: Aug 01 '16