[Documentation] [TitleIndex] [WordIndex

Note: This tutorial assumes that you have completed the previous tutorials: Web App 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 Interactions

Description: Defining interactions that can launch android activities.

Keywords: rocon interactions android

Tutorial Level: BEGINNER


This tutorial will guide you through the process of launching activities on android devices. This has a really strong advantage in that it provides a systematic way of getting parameters and remappings info to the android activity itself.

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


We will create two talker/listener interactions, each going in a different direction (i.e. from pc->android and from android->pc. One we will run on the /babbler topic and the other on the /natter topic.


Let's hypothetically create an interactions yaml called android.interactions in a package called foo.

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

- name: com.github.rosjava.android_remocons.talker.Talker
  role: Android
  compatibility: rocon:/*/*/hydro|indigo/jellybean|ice_cream_sandwich
  display_name: Talker
  description: Natters away like an old nag (/natter topic).
  max: -1
    - remap_from: chatter
      remap_to: /natter

Note the remapping instructions that we will pass on to the android applications from this specification.


Next, we create a launcher that advertises both the master on the local network (via zeroconf) and our interactions that can be run with that master. Also the talker and listener tutorials remapped to the right topics to create the pc endpoinds of the two interactions.

Save the following as android.launch in package foo.

  <!-- ****************************** Arguments ****************************** -->
  <arg name="ros_master_name" default="Rocon Android Interactions"/>
  <arg name="ros_master_description" default="A tutorial environment for android interactions and remocons."/>
  <arg name="ros_master_icon" default="rocon_icons/cybernetic_pirate.png"/>

  <!-- ****************************** Zeroconf ******************************* -->
  <node ns="zeroconf" pkg="zeroconf_avahi" type="zeroconf" name="zeroconf">
    <rosparam param="services" subst_value="true">
        [ { name: "$(arg ros_master_name)", type: _ros-master._tcp, port: 11311, domain: local, description: "$(arg ros_master_description)" } ] 

  <!-- ***************************** Interactions ***************************** -->
  <param name="name" value="$(arg ros_master_name)"/>
  <param name="description" value="$(arg ros_master_description)"/>
  <param name="icon" value="$(arg ros_master_icon)"/>
  <node pkg="rocon_master_info" type="master.py" name="master"/>

  <node pkg="rocon_interactions" type="interactions_manager.py" name="interactions">
    <rosparam param="interactions">[foo/android, rocon_interactions/web]</rosparam>
    <param name="rosbridge_port" value="$(arg rosbridge_port)"/>
    <param name="webserver_address" value="$(arg webserver_address)"/>

  <!-- ******************************* Programs ******************************* -->
  <node pkg="roscpp_tutorials" type="talker" name="pc_talker">
    <remap from="chatter" to="babbler"/>
  <node pkg="roscpp_tutorials" type="listener" name="pc_listener">
    <remap from="chatter" to="natter"/>


We need the android remocon, as well as some android talker/listener applications.



# Dependencies
> sudo apt-get install ros-indigo-roscpp-tutorials ros-indigo-rocon-master-info rocon-interactions ros-indigo-zeroconf-avahi-suite
# set to your IP (need this, it's going to be across the network)
> export ROS_IP=
> roslaunch foo android.launch --screen

Android Phone:

Quick Instructions


> roslaunch rocon_interactions android_demo.launch --screen

Android Phone:

2019-10-12 13:01