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

Rqt command line interface - killing plugins and switching perspectives

asked 2016-04-07 08:51:59 -0600

rbaleksandar gravatar image

Hi everyone! :)

I am struggling with the (probably considered) advanced features of rqt namely using the command line interface in order to control a running rqt instance using IPC (inter-process communication). This question consists of two parts:

  • Killing plugins started as separate processes
  • Switching perspectives

System: Ubuntu 14.04, ROS Indigo (I think it was updated 2-3 months ago)

Killing plugins started as serparate processes

The question here is to find a workaround of the problem described in this section of the post.

Looking at the --help of rqt I got the following (do feel free to correct me if I'm wrong):

  • -m (long: --multi-process) - starts each rqt plugin as a separate process which means that I can get the PID of every pluging in order to manipulate it somehow using UNIX signals. Tested and working as described.
  • --command-pid RQT_PID - used in a combination with other --command-* terminal parameters to control the running rqt instance (oldest one by default which is not something that I need to consider since my use case involves running just a single instance of rqt). Tested and working as described.

    • --command-pid RQT_PID --command-start-plugin RQT_PLUGIN_NAME - given the PID of the running rqt I can pass the name of a rqt plugin I want to start. Tested and working as described.

      Example: rqt --command-pid 10816 --command-start-plugin rqt_rviz/RViz adds rviz the my running rqt

So far so good. The problem is when I want to stop a plugin everything turns know what. I was unable to find a rqt-friendly way of doing that (there is for example no such command as --command-stop-plugin RQT_PLUGIN_NAME) hence the only way that I have found so far is to send a SIGTERM to the PID of the respective plugin.

I have tried using SIGINT but it doesn't seem to work at all and also even when I use SIGTERM the plugin still seems to be running (second image). I wrote seems since the processes is actually no longer there however the plugin (without its content!) remains and also under Running in the menu I can still see Close RQT_PLUGIN_NAME (see third image). Clicking on it doesn't do anything and the entry in the menu doesn't disappear. To be honest I find it very unlikely that anything but kill is to be used to close externally such plugins because of the absence of a --command-stop-plugin ... and the fact that the --command-start-plugin ... takes just the rqt plugin's name which begs the question "What will happen if I want to start and then stop N instances of the same plugin next to each other?"

Before SIGTERM to RViz plugin image description

After SIGTERM to RViz plugin (the plugin is still partially there) image description

After SIGTERM to RViz plugin (the plugin is still registered as a running plugin) image description

Things get even weirder when I reopen rqt (without --clean-config enable of course) - the "corrupted" plugin is loaded and (of course) it appears as one would expect from a pluging that ...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-01-23 14:43:56 -0600

Dirk Thomas gravatar image

I am not surprised that simply killing the processes doesn't work well. rqt doesn't know that the subprocess has been killed. The solution here would be to implement a --command-stop-plugin option. Since you can already perform this task through the UI it shouldn't be too difficult to expose it as in the CLI.

The problem you have with switching the perspective from the command line sounds like this ticket:

edit flag offensive delete link more

Question Tools



Asked: 2016-04-07 08:51:59 -0600

Seen: 1,030 times

Last updated: Jan 23 '17