(!) 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.

Getting Started

Description: A walkthrough of the rocon interactions concepts.

Keywords: rocon interactions

Tutorial Level: BEGINNER

Next Tutorial: Documentation Interactions

Overview

This tutorial is a walkthrough of the rocon interactions concepts. It will illustrate the various features and run the existing demos linking various kinds of interactions with a running ros system.

If you haven't already, make sure you have installed either the rocon tools environment, or the full rocon environment itself.

Specifying Interactions

The first step in getting interactions up and running for your ros system is to setup the interactions file(s). These are just plain yaml files listing a set of formatted interactions.

   1 - name: rocon_interactions/rviz.xml
   2   role: 'PC'
   3   compatibility: rocon:/pc/*/hydro|indigo/*
   4   display_name: Rviz Markers (Launcher)
   5   description: Rviz with a view exactly configured for the rocon_interactions tutorial.
   6   max: -1
   7   icon:
   8     resource_name: rocon_bubble_icons/rviz.png
   9 - name: http://robotics-in-concert.github.io/rocon_tools/js/current/listener.html
  10   role: 'Web Apps'
  11   compatibility: rocon:/*/*/hydro|indigo
  12   display_name: Listener
  13   description: Simple listener using rosjs in a web app.
  14   icon:
  15     resource_name: rocon_bubble_icons/chimek.png
  16   parameters: 
  17     rosbridge_address: __ROSBRIDGE_ADDRESS__
  18     rosbridge_port: __ROSBRIDGE_PORT__
  19   remappings:
  20     - remap_from: /chatter
  21       remap_to: /babbler

Detailed specifications of each field are in the rocon interactions sphinx documentation.

Examples can be found in the indigo sources.

Loading The Interaction Node

Interactions are served from the interactions manager node that is destined to run on your running ros system - either robot or desktop. You can load interactions yaml's in one of three ways:

  1. Via the parameter server and inside the interaction node's private namespace.
  2. Via an external loader script
  3. Parsing the yaml and using the ros api to load/unload interactions from the manager node.

The example loading_demo.launch illustrates methods 1. and 2. Note that the parameter method is via a list of ros resource names pointing to .interactions yaml files in the specified packages.

   1 <launch>
   2   <!-- Publish master info for the remocon -->
   3   <param name="name" value="Rocon Interactions"/>
   4   <param name="description" value="A tutorial environment for interactions and remocons."/>
   5   <param name="icon" value="rocon_icons/cybernetic_pirate.png"/>
   6   <node pkg="rocon_master_info" type="master.py" name="master"/>
   7 
   8   <node pkg="rocon_interactions" type="interactions_manager.py" name="interactions">
   9     <rosparam param="interactions">[rocon_interactions/android, rocon_interactions/pc, rocon_interactions/web_apps]</rosparam>
  10   </node>
  11   
  12   <!-- instead of params, use the external loader and configure groups with default namespaces -->
  13   <node pkg="rocon_interactions" type="load_interactions" name="load_interactions" args="-n '/web' rocon_interactions web">
  14     <remap from="load_interactions/set_interactions" to="interactions/set_interactions"/>
  15   </node>
  16 </launch>

Method 3. is supported by the rocon_interactions.load_msgs_from_yaml_resource function in the rocon_interactions python module.

The launcher also illustrates the necessary advertising information (name, description and icon) that needs to be configured for the interactions node.

   1   <param name="name" value="Rocon Interactions"/>
   2   <param name="description" value="A tutorial environment for interactions and remocons."/>
   3   <param name="icon" value="rocon_icons/cybernetic_pirate.png"/>
   4   <node pkg="rocon_master_info" type="master.py" name="master"/>

This information is used to inform remocons who and what running system it is serving in a human identifiable way.

Launching the Interactions Node

The loading demo launcher loads all manner of interactions, most of which won't actually do anything useful because the running system doesn't support them (e.g. listener interaction with no talker). It is intended just to show how to load and introspect what has been loaded.

> roslaunch rocon_interactions loading_demo.launch --screen

You can introspect on what has been loaded with the command line rocon_interactions tool which sorts and pretty prints the loaded interactions (you could also directly call the get_interactions topic with empty filters and wade through the response manually).

> rocon_interactions

rocon_interactions.png

Remocons

Interactions are of no use unless they are discoverable by a user. This is where the remocons come in - they are frontend for users that connect to the interactions manager node with whome they negotiate what interactions they are permitted to start (and how) on behalf of the user. The user is then presented this list of interactions with a minimum of fuss.

The qt remocon is designed to be used from the same ros master network. That is, it launches from a ros environment with ROS_MASTER_URI pointing to the same master as the interactions node. We'll use this remocon in a few quick demos to give you a feel for what is possible.

Demos

PC Interactions

The next demo loads up qt, rqt and rviz interactions accessed over the qt remocon. These three illustrate how to configure interactions for global programs, rosrunnables and roslaunchables. Note that the pc demo launcher also starts up a script which periodically publishes visualization markers for rviz (just to give it something to do).

# Make sure you have rqt plugins, rviz and the remocon for this tutorial
> sudo apt-get install ros-indigo-rqt-graph ros-indigo-rocon-remocon ros-indigo-rviz ros-indigo-visualization-msgs
> roslaunch rocon_interactions pc_demo.launch --screen
# In a second shell
> rocon_remocon

rocon_remocon.png

With the remocon, add a new connection using the environment variables and choose the pc roles list. Roles for a real system would more likely reflect the user's role (e.g. admin, dev, customer) rather than the type as we've done here.

Up to this point, the remocon has engaged in a dialogue with the interactions node to work out what interactions are launchable from the qt remocon. It uses the get_interactions service to do this and sends the interactions node it's own rocon_uri to establish compatibility matches with each interaction's specification. Only those that are compatible are ultimately displayed in the remocon (obviously no android apps will get shown here).

Upon selecting an interaction in the remocon, the remocon will proceed to establish a hidden ros environment for each of the apps in which the specified interaction will launch. The interactions here demonstrate launching of global script (qt program), a rosrunnable (rqt plugin) and a roslauncher (rviz configuration).

Web URL Interactions

> roslaunch rocon_interactions pc_demo.launch --screen
# In a second shell
> rocon_remocon

Same launcher, but this time drop into the 'Web' role instead of the 'PC' role. Here are interactions with web url's. This is perfect for directing your users directly to documentation of interest or importance to a running system.

Web App Interactions

# Make sure you have the remocon and rosbridge dependencies installed
> sudo apt-get install ros-indigo-rosbridge-suite ros-indigo-rocon-remocon ros-indigo-roscpp-tutorials
> roslaunch rocon_interactions web_demo.launch --screen
# In a second shell
> rocon_remocon

Enter your ros master, click on the 'Web Apps' role and fire up the listener, hit F12 and select the console view which will show you some output from the talker started by web_demo.launch.

What's going on here? Although it's almost transparent to the user, quite alot is going on. More detail will come in a later tutorial, but the sketch below should be enough of a teaser.

Web App Execution

The params, remapping and rosbridge info gets passed to the web app on a specially formatted query string which is decoded using javascript from a library supplied by the rocon_interactions package and served from github.io. The following lines are extracted from the listener.html used in this example:

   1 <script type="text/javascript" src="http://robotics-in-concert.github.io/rocon_tools/js/indigo/interactions.js"></script>
   2 <script type="text/javascript" type="text/javascript">
   3 
   4   console.log("Display Name : " + rocon_interactions.display_name)
   5   console.log("Rosbridge URI: " + rocon_interactions.rosbridge_uri)
   6   console.log("Parameters   : " + JSON.stringify(rocon_interactions.parameters))
   7   console.log("Remappings   : " + JSON.stringify(rocon_interactions.remappings))
   8 ...

Wiki: rocon_interactions/Tutorials/indigo/Getting Started (last edited 2014-05-02 02:36:50 by DanielStonier)