Note: This tutorial assumes that you have completed the previous tutorials: Getting Started.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Qt Interactions

Description: Defining interactions for qt based frontends.

Keywords: rocon interactions qt

Tutorial Level: BEGINNER

Next Tutorial: Rviz Interactions

Overview

This tutorial will guide you through the process of running and executing qt or rqt based interactions.

Qt programs that connect with ros can be varied - they can be built and run from catkin packages in a ros environment or they can be completely standalone. Standalone doesn't sound immediately obvious, but consider this use case - you wish to launch qt frontends on a pc that is networked to your robot in order to monitor operating system diagnostics. This has no ros communications involved, but can be conveniently served by the interactions node and started by the qt remocon.

Skip to the Quick Instructions if you just want to run/test some existing qt interactions.

Interactions

Yaml

Let's throw a couple of interaction types around. In the following we have a pyqt script that is on the global PATH as well as a rosrunnable script that enables a rqt plugin. Save this as foo.interactions in foo.

   1 - name: rocon_master_info
   2   role: 'PC'
   3   compatibility: rocon:/pc/*/hydro|indigo/precise|quantal|raring|saucy|trusty
   4   display_name: Rocon Master Info (Direct Executable)
   5   description: Generic information about this master.
   6   max: -1
   7 
   8 - name: rqt_graph/rqt_graph
   9   role: 'PC'
  10   compatibility: rocon:/pc/*/hydro|indigo/precise|quantal|raring|saucy|trusty
  11   display_name: Rqt Graph (Ros Runnable)
  12   description: Graph of all topics and services in the concert workspace.
  13   max: -1
  14   icon:
  15     resource_name: rocon_bubble_icons/rqt.png

Note how the rosrunnable item is specified by a ros resource pair (pkg/name). For both, there is not currently any way of passing parameters and remappings. A way of supporting command line args is coming soon. Use a bash or python script as a workaround, or drop your rosrunnable into a launcher.

Launcher

Save this as foo.launch in foo.

   1 <launch>
   2   <param name="name" value="Rocon Interactions"/>
   3   <param name="description" value="A tutorial environment for interactions/remocons."/>
   4   <param name="icon" value="rocon_icons/cybernetic_pirate.png"/>
   5   <node pkg="rocon_master_info" type="master.py" name="master"/>
   6 
   7   <node pkg="rocon_interactions" type="interactions_manager.py" name="interactions">
   8     <rosparam param="interactions">[foo/foo]</rosparam>
   9   </node>
  10   <node pkg="roscpp_tutorials" type="talker" name="talker">
  11     <remap from="chatter" to="babbler"/>
  12   </node>
  13 </launch>

Here we've added a a talker so rqt_graph has something to graph.

Interacting

# Dependencies
> sudo apt-get install ros-indigo-rqt-graph ros-indigo-roscpp-tutorials ros-indigo-rocon-master-info
# In the first shell
> roslaunch foo foo.launch --screen
# In a second shell
> rocon_remocon

Add your ros master and fire up the qt applications.

Variations

Rqt Plugin Scripts

Not every rqt plugin has a script like rqt_graph. You can very easily do the same for your custom plugin though. If you look at the script for rqt_graph, it looks like:

import sys

from rqt_gui.main import Main

main = Main()
sys.exit(main.main(sys.argv, standalone='rqt_graph'))

Once you have a script, either install it in the package (rosrunnable) or as a global script (direct execution) and call it in the interactions as shown above.

Rqt Perspectives

If however you want to start a more complicated rqt perspective, then 1) export the perspective into a package somewhere and 2) create a launcher which runs rqt with the --perspective-file argument and uses roslaunch find patterns to find the file.

- name: foo/my_rqt_perspective.launch
  role: 'Git Clone'
  compatibility: rocon:/pc/*/hydro|indigo/*
  display_name: Rqt Custom Perspective (Launcher)
  description: A custom configured perspective with rqt.
  max: -1
  icon:
    resource_name: rocon_bubble_icons/rqt.png

where your launcher might look something like:

   1 <launch>
   2   <node name="my_rqt_perspective" pkg="rqt_gui" type="rqt_gui" args="--perspective-file  $(find my_rqt_perspective)/perspectives/dude.perspective"/>
   3 </launch

Quick Instructions

First shell:

> roslaunch rocon_interactions pc_demo.launch --screen

Second shell:

> rocon_remocon
  • Add a master, (default choice of localhost usually fine) and select it.
  • Select the 'PC' group
  • Choose any of the interactions available.

Wiki: rocon_interactions/Tutorials/indigo/Qt Interactions (last edited 2015-02-22 14:31:59 by DanielStonier)