0
$\begingroup$

Rosanswers logo

I'm writing a RQT plugin that includes some functionality of other plugins, as well as my own.

My plugin is in C++, because I'd like to add some rqt_rviz visualization. Mainly the OGRE window.

Along side the RViz visualization, I want to add some functionality of the rqt_bag plugin. I plan on branching this plugin and heavily modifying it.

I want to combine the two plugins in code and create my plugin. I'll call that rqt_curranw. The final product (assume rqt_bag will be much different) looks like the screenshot attached.

The issue is...rqt_bag is written in Python and rqt_rviz is written in C++. I can create two plugins and dock them next to each other, but I'd rather have my single plugin include all of the functionality I want. No extra steps. I can kind of get around this by using a perspective, but I don't see a way to include arguments to the plugins using perspectives.

So my question is, how can I include functionality from both plugins in my one plugin widget? In C++, I can use the pluginlib::ClassLoader to upload the rqt_rviz plugin, and use the functions associated with that class. However, I can't use it to load the rqt_bag plugin, since it's written in Python.

I've looked through rqt_gui for inspiration and it's a monster. I'm hoping to find some quick answers here before jumping down that rabbit hole.

Thoughts:

  • Is there a way to latch onto an existing QtApplication. For example, if the QtApplication is written in C++ can a simultaneous Python process access it and add widgets to it? Or vice-versa?

  • I assume there is a way to do this, since rqt_gui uploads both Python and C++ plugins, and is written in Python.

  • Is there a way to hack perspectives to use plugin arguments? Is this the right approach?

  • Am I barking up the wrong tree and over-complicating things?

image description


Originally posted by curranw on ROS Answers with karma: 211 on 2016-03-30

Post score: 2


Original comments

Comment by 2ROS0 on 2016-08-15:
I'm looking to do something similar. Which path did you go down finally? Any suggestions based on your experience?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Mixing two languages in a single rqt plugin is not supported. rqt does a lot of internal work to enable using different languages and I don't think you want to go down that rabbit hole in a single plugin.

I see two viable options to proceed:

  • Keep using two separate plugins, one in C++, one in Python and let them interact through ROS communication patterns with each other (messages, services). The "only" downside is that the user has to open two plugins. (It would be possible though to add API to rqt to enable plugins to start other plugins somehow automatically.)

  • Reimplement the rqt_bag user interface in C++ using the C++ API of rosbag. The significant downside of this is the effort since rqt_bag does quite a lot of stuff already.

Since option 2 is quite some effort I would suggest option 1.


Originally posted by Dirk Thomas with karma: 16276 on 2016-03-30

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by 2ROS0 on 2016-08-15:
I'm facing a similar situation - where I want to have my plugin (in C++) run along with a modified rqt_plot as a single app. How difficult would it be to implement? I know you mentioned it's a lot of work, but I was wondering how much is a lot. :)

Comment by curranw on 2016-08-18:
I ended up ditching the idea and using RViz and rqt_bag separately.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.