Rosanswers logo

Hi to all,

On several occasions I have created rqt plugins for monitoring different devices, and for interacting with robots graphically. In this occasion, i have a robot with eight video cameras and i want to visualize all of them in rqt. My idea is to create a menu in "Plugins", with a group named Cameras and within it, all the cameras of the robot. I mean:

   |_ Cameras
          |_ Top_camera
          |_ Right_camera
          |_ Left_camera
          |_ ...

I already know that exists the image_view plugin for this type of things. But i need that an end user can choose between all of the cameras easily. When the user select, for example, Top_camera, it should appear an image_view screen with the current images of that camera. (In other words, i need an image_view with the image topic already selected. Totally transparent for the user).

Is possible to do this, reusing the already implemented image_view plugin?

I am modifying the plugin.xml file to launch multiple instances, unsuccessfully:

 <class name="rqt_image_view/ImageView" type="rqt_image_view::ImageView" base_class_type="rqt_gui_cpp::Plugin">

        <icon type="theme">folder-new</icon>

      <label>PTZ top</label>
      <icon type="theme">camera-photo</icon>
      <statustip>Great user interface.</statustip>

I should need eight different image_view with the corresponding topic preselected. How can i do it?

Thank you very much in advance ;)

Originally posted by Jose Luis on ROS Answers with karma: 375 on 2015-01-13

Post score: 4


2 Answers 2


Rosanswers logo

AFAIK there isn't a way to achieve what you want other than creating a custom rqt plugin on your own. This custom plugin, however, can be relatively low-cost.

Instead of explaining it in the answer thread, I just added a tutorial section for how to re-use exising (r)qt components.

In your particular scenario, I would do the following, in addition to general steps in the tutorial above:

  • In .ui, define the customwidget as many as you need using the right class from rqt_image_view. Differentiate each instance by name attribute (as instructed in the tutorial).
  • In the program, specify which image topics should go to which image_view instance.

Hope the this makes sense, along with the tutorial just added.

Update) @wolf opened another thread http://answers.ros.org/question/201064/custom-rqt-gui/ where a simpler workaround is referenced.

Originally posted by 130s with karma: 10937 on 2015-01-15

This answer was NOT ACCEPTED on the original site

Post score: 2


Rosanswers logo

Finally I have achieved that i want. I have followed the suggestions of @130s and I have added other things that were necessary.

Perhaps my solution is not the best one or there are another possibilities, but it works perfect.
To obtain a custom ImageView plugin for each camera, I have done the following:

  • I've copied the original code of imageView into my own package.
  • I've modified some lines in the code for getting the image topic that i want for each camera.
  • I've created one class for each camera. (This is necessary because you need to instantiate the classes in the "plugin.xml" file and the attribute must be different for each instance)
  • I only use one .ui file. All the classes are using the same file:
--- CMakelist.txt ---
    set(my_cameras_UIS  src/my_cameras/image_view.ui)
  • The main concept to understand is in plugin.xml:

image description

The Class name tag must be different for each instance.

I have obtained this:

image description

Hopefully this will be useful for others.

Originally posted by Jose Luis with karma: 375 on 2015-01-19

This answer was ACCEPTED on the original site

Post score: 3

Original comments

Comment by Dirk Thomas on 2015-01-19:
Instead of copying the code it would be much better to reuse the code of the existing plugin. If it does not provide the necessary API for that you might consider providing a pull request to enhance the existing plugin in a way that you can reuse it's functionality for you custom plugin.

Comment by Jose Luis on 2015-01-20:
I know what you say, is the best way to do this. But in this case, i needed a very concrete thing, with little changes in the code. It is not very reusable for others. I think that a pull request should be done with generic code.Thus, i have done it by this way.I appreciate your contribution, thanks


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.