Ask Your Question
2

Including both Python and C++ Plugins in a single RQT Plugin

asked 2016-03-30 13:16:37 -0600

curranw gravatar image

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

edit retag flag offensive close merge delete

Comments

I'm looking to do something similar. Which path did you go down finally? Any suggestions based on your experience?

2ROS0 gravatar image2ROS0 ( 2016-08-15 17:54:32 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-03-30 13:49:10 -0600

Dirk Thomas gravatar image

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.

edit flag offensive delete link more

Comments

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. :)

2ROS0 gravatar image2ROS0 ( 2016-08-15 17:59:04 -0600 )edit

I ended up ditching the idea and using RViz and rqt_bag separately.

curranw gravatar imagecurranw ( 2016-08-18 13:19:06 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-03-30 13:16:37 -0600

Seen: 362 times

Last updated: Mar 30 '16