Note: This tutorial assumes that you have completed the previous tutorials: Android Interactions.
(!) 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.

Android Pairings

Description: Simultaneously bring up & tear down an android listener/robot talker pair.

Keywords: rosjava

Tutorial Level: ADVANCED

Android interactions work with a static robot, i.e. robot side software doesn't change with the launch of the android application. Android pairings, however, provide a means for your android application to come up and be torn down together with a specified roslaunch configuration on the robot.


In the example here we will simultaneously bring up/tear down a listener on the android and a talker on the robot.


About

The assumption inherent in a conventional android interaction is that the robot side topics and services are already running. This is almost always not true. For example, a roslaunch to make a map will never be running alongside the roslaunch that navigates the building. A user friendly pair of android interactions to these are defeated if the user has to anyway 1) ssh into the robot, 2) kill the make a map roslaunch and 3) fire up the navigation roslaunch.

The rocon_interactions infrastructure and rocon_app_manager come to the rescue here by allowing you to specify a rapp1 inside the interactions configuration. This enables the following workflow:

  1. (Android Device) Remocon receives a list of interactions from the interactions manager.
  2. (Android Device) The user starts an interaction from the android remocon.
  3. (Android Device) The android activity starts.
  4. (Robot) The interactions manager passes the rapp request to the rocon app manager
  5. (Robot) The rocon app manager launches the specified rapp.

At this point the remocon-interactions manager-rocon application manager triumvirate manage the life cycle so that if either side goes down, the other is gracefully terminated as well.

Example

The following example extends the talker-listener of the previous tutorial by pushing the launch/management of the talker node to the rocon_app_manager.

Prerequisites

Robot

> sudo apt-get install ros-indigo-rocon-interactions ros-indigo-rocon-master-info ros-indigo-zeroconf-avahi-suite ros-indigo-rocon-app-manager ros-indigo-rocon-apps

Android Device

Both of these are compilable from source via the android_interactions suite or (when available) obtainable from the google play store.

  • The android remocon.
  • The listener application.

Yaml

In comparison to the previous tutorial, the interactions yaml merely adds a pairing configuration:

- name: com.github.rosjava.android_remocons.listener.Listener
  role: Android
  compatibility: rocon:/*/*/indigo/jellybean|ice_cream_sandwich
  display_name: Listener
  description: Tunes into the babble (/babbler topic).
  max: -1
  remappings:
    - remap_from: chatter
      remap_to: /babbler
  pairing:
    rapp: rocon_apps/talker
    remappings:
      - remap_from: chatter
        remap_to: /babbler

Note that we've also remapped the talker that will be launched on the robot side.

Rapp

The pairing rapp specified here is the official rocon_apps/talker rapp. As you can see the configuration of this rapp is very simple. Such a rapp needs only exist somewhere inside a catkin package with a single exports line in the package.xml.

RosLaunch

In comparison to the previous tutorial, the roslaunch is much simpler. Since interactions machinery is used by the rocon app manager anyway, it embeds the configuration inside a few simple parameters to another launcher.

   1 <launch>
   2   <include file="$(find rocon_app_manager)/launch/standalone.launch">
   3     <arg name="interactions"           value="true"/>
   4     <arg name="interactions_list"      value="[foo/android]"/>
   5     <arg name="rapp_package_whitelist" value="[rocon_apps]"/>
   6     <arg name="robot_name"             value="Android Pairings"/>
   7     <arg name="robot_type"             value="pc"/>
   8     <arg name="robot_icon"             value="rocon_icons/cybernetic_pirate.png"/>
   9     <arg name="robot_description"      value="An android pairing tutorial." />
  10   </include>
  11 </launch>

Important parameters.

  • interactions_list : as before, where are interactions yaml can be found.

  • rapp_package_whitelist : the package where rocon_apps/talker can be found.

Activity

We use the same listener activity as in the previous tutorial. No changes required.

Execution

PC

  • Export an appropriate ROS_IP.

  • Roslaunch the roslaunch file above. Use --screen to get verbose logging.

Android

  • Start the remocon
  • Scan for your master
  • Select the master, role and start the Listener interaction.

Results

You should see the talker getting started/stopped as the android listener activity starts & finishes.

remocon_listener.png rapp_start.png

Footnotes

  1. A rapp is in most cases nothing more than a glorified roslaunch with some information used by the rocon app manager for launching and tearing down. (1)

Wiki: android/Tutorials/indigo/Android Pairings (last edited 2015-03-20 02:35:36 by DanielStonier)