|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 PairingsDescription: Simultaneously bring up & tear down an android listener/robot talker pair.
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.
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.
- (Android Device) Remocon receives a list of interactions from the interactions manager.
- (Android Device) The user starts an interaction from the android remocon.
- (Android Device) The android activity starts.
- (Robot) The interactions manager passes the rapp request to the rocon app manager
- (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.
> 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
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.
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.
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.
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>
interactions_list : as before, where are interactions yaml can be found.
rapp_package_whitelist : the package where rocon_apps/talker can be found.
We use the same listener activity as in the previous tutorial. No changes required.
Export an appropriate ROS_IP.
Roslaunch the roslaunch file above. Use --screen to get verbose logging.
- Start the remocon
- Scan for your master
- Select the master, role and start the Listener interaction.
You should see the talker getting started/stopped as the android listener activity starts & finishes.
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)