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

Initialize rospy in rqt_plugin

asked 2014-02-03 22:59:21 -0600

Felix Messmer gravatar image

updated 2014-02-03 23:48:57 -0600

Dear all,

I am trying to write a simple rqt_plugin for ROS Groovy in Python. The plugin is located in a rosbuild package.
My plugin is supposed to publish to a topic using data entered in the UI created with qt-designer.
I already can start the UI to fill a visualization_msgs::Marker message with the according current data. I can also use my plugin both standalone (rosrun my_pkg my_plugin) as well as with rqt.

However, after starting the pulugin, there is no ROS node initialized for it. Thus, also the topic is not advertised and I get an error when calling the publish() function of the Publisher I created in the plugin
Error Message: rospy.exceptions.ROSException: ROS node has not been initialized yet. Please call init_node() first

As I read in the tutorial, the plugin itself should not call init_node() as rqt is doing this.
So where does this initialization happen? Do I need to overload a certain function?
My plugin is derived from rqt_gui_py.plugin.Plugin.
I use a separate my_plugin_widget class similar to the existing rqt_plugins (e.g. rqt_publisher).

One thing, I found is that I need to set qt_gui_py::Plugin as the base_class_type within the plugin.xml

<class base_class_type="qt_gui_py::Plugin" name="MirorRGB" type="miror_rqt_gui.miror_rgb.MirorRGB">
...
</class>

Also, I need to have

  <export>
     <qt_gui plugin="${prefix}/plugin.xml">
  </qt_gui></export>

in my manifest.xml in order to be able to find my plugin with rqt --list-plugins and to be able to start it.

This is different from what the tutorials on the ROS wiki states where rqt_gu_py::Plugin is used in the plugin.xml and rqt_gui in the manifest.xml.

I hope someone is able to help.
If more information on my setup is needed, feel free to ask.

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-02-04 05:37:03 -0600

PiotrOrzechowski gravatar image

updated 2014-05-28 23:32:09 -0600

130s gravatar image

You have a typo in both plugin.xml and package.xml. It's rqt_gui not qt_gui

Use rqt_gui_py::Plugin as the base class in your plugin.xml file and use

<export>
  <rqt_gui plugin="${prefix}/plugin.xml"/>
</export>

in the manifest.xml

EDIT: Just realized you use rosbuild. But it's still rqt_gui Have a look at this answer: answers.ros.org/question/65679/install-rqt-plugin-with-rosbuild/?answer=65698#post-id-65698 and the rqt_console code for fuerte: github.com/ros-visualization/rqt/tree/fuerte-devel/rqt_console

(Sorry for the unformatted links - my karma is insufficient...)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-02-03 22:59:21 -0600

Seen: 662 times

Last updated: May 28 '14