(!) 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.

Launching Existing Applications from Android

Description: If you have an application that runs from a single launch file, or can be made to run from a single launch file then here's how to launch that application from an Android Device.

Tutorial Level: BEGINNER

The Tuck Arms Launch Example is an example of the whole process of making the application accessible from an Android Device, which you can follow along with while reading this.

Launch File

Your application must have a single launch file to launch all the nodes needed to run your application. This means that if you traditionally launch more than one .launch file then you need to include both of them in the new .launch file that you want to launch from the Android device.

An example of this would be the pick_and_place_demo_app, which includes the pr2_tabletop_manipulation_launch file because that demo is normally run by launching two launch files.

Create Your Package

If your application happens to already have a single launch file and then in theory you do not need to make a new package. You can skip this step and just run the tool that generates all of the Android-related files.

If you made a new launch file (or if you just want to make a new package for this) then you should probably make a new package or unary stack. It's your choice, but you can use roscreate-pkg or roscreate-stack to make the new package.

It is also important that there are no two files with the same name anywhere in the package.

All paths here are ROS paths, so you just need to give <package>/<filename> with no intermediate directories.

Navigate to your package and run this script app_files_create. The command to run the script is as follows:

./app_files_create --create <packagename> <iconpath> <displayname> <description> <launchfilename> <platform>
  • <packagename> is just the name of the stack or package that you are running the tool inside

  • <iconpath> is the absolute or relative path to the icon you want the Android device to use to represent your app

  • <displayname> is a human-readable string for the name of your application

  • <description> is another human-readable string to describe the application

  • <launchfilename> is the name of the launchfile including the .launch extension. You do not need to specify where in the package it is (i.e. whether or not it's in a launch directory).

  • <platform> is the robot it's run on, for example the Pr2 or the turtlebot

If you're doing this on a pr2 and you specify that as the platform on the command line then the script will put a copy of the .installed file in ~/local_apps for you. If you specify that it's a turtlebot it will append some text to mock_apps/turtlebot_apps.installed. Otherwise it will create the following files in the root of your package:

  • .app file that points to your launch file and has some important information about your application
  • .installed file which points to your .app file. It should be located somewhere where the app_manager will find it. On the Pr2 that's in ~/local_apps. On the turtlebot it's turtlebot_bringup/mock_apps.
  • .interface file, which is currently not used and is mostly empty

More information about these files can be found here: ApplicationsPlatform/CreatingAnApp.

It is possible to create multiple apps from multiple launch files in the same package. Just run this script again with different parameters. The next step can be performed only once per package after all of your app files are generated.

Installing Your Application

After you run the script above it will print a message with some instructions. Here are those instructions again. It's similar to what's in ApplicationsPlatform/CreatingAnApp except that the script you just ran takes care of some of the steps for you.

Add the following line to your .rosinstall file:

- other: {local-name: $package}

Then type:

rosinstall .

If necessary add

echo "Sourcing /u/applications/ros/setup.bash"
. /u/applications/ros/setup.bash

(or the applicable lines as directed by the output message from the last command) to the .bashrc in the home directory. These lines might already be added if there are already applications installed from the same ROS install directory.

Testing App

De-activate your robot by shutting down the app manager (on most robots, connect with an android device and hit the "deactivate" button). Restart your robot (on most robots, connect with your android device).

You should now see your application listed on your device. If you see no applications listed, this means that your application's formatting is invalid, and it has caused errors. If you do not see your application listed at all, this means that you have skipped a step or failed to restart the app manager.

Once you are confident that your app works. You can add it to the ROS Exchange so that others can use it too.

Wiki: ApplicationsPlatform/Clients/Android/LaunchingExistingApplicationsFromAndroid (last edited 2012-03-23 23:17:44 by SarahElliott)