Note: This tutorial assumes that you have completed the previous tutorials: Pairing with Androids. |
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 a Robot App
Description: How to create and install a robot application (rapp) for pairing or concert modes.Keywords: rapp
Tutorial Level: INTERMEDIATE
Next Tutorial: Create an Android App
These specifications are likely to evolve and mutate over the course of hydro. |
What is a Rapp?
A rapp is a robot (or rocon) application. This is the entity that is installed and executed by the robot application manager. Typically a rapp is simply a ros launcher with a rapp specification (metadata, icon, public interface). No code, just dependencies on code packages.
Breakdown
A simple example is the talker app. A quick browse through the files should give you something of an inkling on what is going on. A more detailed breakdown of the three files:
Launch
<launch> <node name="talker" pkg="rospy_tutorials" type="talker" output="screen"/> </launch>
This is what the robot app manager launches when requested to start your app. There are no special buttons and whistles beyond the usual capabilities of a roslaunch file.
Interface
publishers: - chatter subscribers: [] services: []
This is the parts of your software that will be exposed to remote systems for either pairing or concert (multimaster) modes. At the moment it is a yaml list of publishers, services, action_clients and action_servers.
Rapp
display: Talker description: Default ros style talker tutorial platform: linux.ros.* launch: rocon_apps/talker.launch interface: rocon_apps/talker.interface icon: rocon_apps/rocon_bubble.png pairing_clients: - type: android manager: api-level: 10 intent-action: com.github.ros_java.android_apps.listener.Listener
This file stores all the meta-data for the application. Each of the fields should be self-evident. Note that the values for the interface and icon keys are resource names.
The pairing clients information is not necessary if you are not planning to run your rapp in pairing mode with an android application (e.g. chirp).
Create
A rapp can be a standalone ros package, or you can collect a group of rapps together inside a single package (e.g. rocon apps). In either case, simply follow the steps below to create your own rapp:
- Create a folder for your rapp
Copy the interface, rapp and launch file from the talker rapp.
- Modify the contents of these to suit your application.
Install
You now need to inform the robot app manager about your rapp. Later we plan to utilise repositories with meta-information about the rapps, but for now they are simply locally installed on the robot.
The robot app manager accepts yaml based lists of rapps referenced by resource names and have the .rapps extension. e.g.
apps: - rocon_apps/chirp - rocon_apps/talker - rocon_apps/listener
These can be anywhere on the system, but usually a good convention is to put a rapp list at the root of your package's rapp collection (e.g. rocon.rapps.
Once you have a rapp list, you can inform the robot app manager of the list by passing it as an arg to the robot app manager launcher (to either of the standalone or paired launchers)
For example, a simple roslauncher which customises the standalone launcher:
<launch> <arg name="rapp_lists" default="rocon_apps/rocon.rapps;my_apps/my_apps.rapps"/> <include file="$(find rocon_app_manager)/launch/standalone.launch"> <arg name="rapp_lists" value="$(arg rapp_lists)" /> </include> </launch>