Note: This tutorial assumes that you have completed the previous tutorials: Interacting with your Turtlebot, Create your First Rapp.
(!) 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.

Create your First Interaction

Description: Create, load and execute a 'babbler' interaction.

Keywords: turtlebot rapp

Tutorial Level: INTERMEDIATE

Next Tutorial: Adding New 3D Sensor

Create, load and execute your first two-sided interaction.


Goal

Our goal here is to implement the second side (the user side) of the interaction that we started when creating your first rapp. For this we will setup and configure a roslaunch'able listener so that when a user requests the interaction to be started via remocon, both talker and listener come up together.

Getting Dirty

We'll continue to use the package my_rapps_tutorial:

> roscd my_rapps_tutorial
> mkdir launch interactions

Create

Create the following files (informative comments included inline in the files):

my_rapps_tutorial/launch/listener.launch

   1 <launch>
   2   <!--
   3     Using an arg lets the remocon configure this variable in the interaction
   4     specification as a parameter (my.interactions)
   5   -->
   6   <arg name="topic_name" default="chatter"/>
   7   <node name="listener" pkg="rospy_tutorials" type="listener" required="true">
   8     <remap from="chatter" to="$(arg topic_name)"/>
   9   </node>
  10 </launch>

my_rapps_tutorial/interactions/my.interactions

   1 # Resource name (pkg/launcher) for a roslaunch interaction
   2 # Can do global exes, rosruns, url's web apps, android apps as well
   3 name: my_rapps_tutorial/listener.launch
   4 # Display name used by the remocon
   5 role: My Interactions
   6 compatibility: rocon:/pc/*/indigo/trusty
   7 display_name: Babbler
   8 description: Start a talker-listener pair chatting on 'babbler'.
   9 max: -1
  10 parameters:
  11   topic_name: babbler
  12 icon:
  13   resource_name: rocon_bubble_icons/ros.png
  14 pairing:
  15   rapp: my_rapps_tutorial/babbler
  16   remappings: []

Load

The next goal is to make sure this interactions file gets loaded by the turtlebot app manager. On the turtlebot (after sourcing your setup.bash) you should find the following environment variable defined:

> env | grep TURTLEBOT_INTERACTIONS_LIST
TURTLEBOT_INTERACTIONS_LIST=[turtlebot_bringup/admin.interactions, turtlebot_bringup/documentation.interactions, turtlebot_bringup/pairing.interactions, turtlebot_bringup/visualisation.interactions]

Here you can see the turtle has loaded various interactions already. Let's load ours along with just the basic existing interactions:

> export TURTLEBOT_RAPP_PACKAGE_WHITELIST="[my_rapps_tutorial]"
> export TURTLEBOT_INTERACTIONS_LIST="[turtlebot_bringup/documentation.interactions, my_rapps_tutorial/my.interactions]"

Restart the turtle:

> roslaunch turtlebot_bringup minimal.launch --screen
.....
[INFO] [WallTime: 1426502367.475830] Rapp Manager : 'my_rapps_tutorial/babbler' added to the list of runnable apps.
.....

Call the interactions manager to see if your interaction was loaded:

> rocon_interactions
My Interactions
  Babbler
    Name         : my_rapps_tutorial/listener.launch
    Description  : Start a talker-listener pair chatting on 'babbler'.
    Icon         : rocon_bubble_icons/ros.png
    Rocon URI    : rocon:/pc/*/indigo/trusty
    Namespace    : /
    Max          : infinity
    Hash         : -92864946
    Pairing      : my_rapps_tutorial/babbler
Documentation
  TurtleBot Google+
    Name         : https://plus.google.com/+TurtleBot/posts
    Description  : Official TurtleBot Google+
    Icon         : rocon_bubble_icons/ros.png
    Rocon URI    : rocon:/pc
    Namespace    : /
    Max          : 1
    Hash         : 364802305

Execute

Assuming you've already restarted the turtle above, start the remocon and fire up the My Interactions/Babbler interaction.

first_interaction.png

Other Interactions

You can also generate other interactions for which there are already many examples you can find in turtlebot_bringup/interactions.

  • 1 sided monitoring applications, e.g. rqt_graph
  • turtle-android application pairs
  • turtle-web app pairs
  • documentation urls
  • global executables

Good luck!

What Next?


You are done!


If you wish, check out the more esoteric use cases mentioned in the Appendix on the TurtleBot main page.

Wiki: turtlebot/Tutorials/indigo/Create your First Interaction (last edited 2016-08-22 17:54:25 by KevinWells)