[Documentation] [TitleIndex] [WordIndex

This information dates back to where it was used on Turtlebot 1 and PR2 in fuerte, groovy and experimental hydro. Aot of it is still useful, but also much outdated now - particularly the android sections. If you'd like to update to doing things on hydro, especially for Turtlebot 2, start at the rosjava and android pages as well as the rocon_app_platform.

Overview

The android application platform client lives in the android_app_chooser package. The android applications use libraries from the android_core package.

If you want to write your own Android apps for compatibility with ROS Hydro, you should start here.

Installation on to Android Devices

A simple way to install the applications platform is to download the ROS Applications Chooser from the Android market. You can do this by going to the android market place with the following link: app chooser

Or if you just open the Market and search OSRF then you'll see it come up as the ROS Application Chooser.

Or by scanning the QR code with your phone's barcode scanner app: Raw image

Using the Application Chooser

Once you open up the application chooser,you will see some buttons at the bottom of the screen. If there's a robot nearby, you can push "Add a robot" to add it to your list of available robots.

There are a couple of different ways to add robots.

To connect a PR2: Master URI and control URI are necessary.

To connect a turtlebot: Master URI is necessary.

As you know, master URI is like this:

http://IP_ADDRESS:11311

control URI:

http://pri1/cgi-bin/control.py

1:If you know above information, you can type it into necessary fields on in the "Add a robot" dialog. The other fields are optional.

2:Some information can be encoded in a QR code. It is generated using the Zebra Crossing QR Code Generator (for more on that see pr2_app_manager). If there is a QR code, you can scan that by pushing the "Scan a QR-code URI" button in the dialog. It should open a scanner application if it's installed. If it's not, you will be prompted to download it.

3:If robots are on the local network, you can find them by pushing the "Search for local network" button in the dialog. Then you can see the list of found robots. Choose checkboxes and push the "Select" button, and you can add them.

This function is realized by using zeroconf. So you should use avahi in robots to tell android devices about their information. Robots have to declare themselves as ros-master like this:

avahi-publish -s turtlebot _ros-master._tcp 8888

Once you see the robot appear at the top of the screen, you can click on it to connect. If someone else has already claimed the robot, you will be asked if you want to evict that user.

Assuming you've found an unoccupied robot and connected, the robot will start and your device should show you a list of apps. If you've only installed the Application Chooser so far then when you try to click those apps it will prompt you to download them from the Android Market. All of the apps by OSRF can also be found by just searching OSRF on the Android Market.

Once you've downloaded some apps, go back to the Application Chooser. Resist the temptation to click the "Open" button in the Market.

If you are using a turtlebot or another robot that uses the ROS Exchange and no apps are shown when you start the robot, then they're probably not installed on the robot either. If you don't know what that is, then you can find out here ApplicationsPlatform/ApplicationsPlatformOverview.

Once you've installed some ROS Android apps on your device, you will see icons for things like Teleop and MakeAMap among your other apps. Most users should only run the apps through the App Chooser application. If you select the icon for the apps outside of the App Chooser, you usually cannot work it successfully. There is a fixed robot and package (This information is written in the wiki page of each application) when you would like to run it without the App Chooser.

Creating Your Own Android App

If you want to create your own Android Application compatible with App Chooser, you should read the the following. If you simply want to use existing applications, please install the applications from the Android Market and don't need to read the following.

If you don't know how to create a common Android Application compatible with ROS, you should read android_core at first.

As you know, you usually extends Ros Activity to make your own Activity for a common Android Application. But you should extends Ros App Activity to create one compatible with App Chooser.

Ros App Activity is extended Ros Activity and has the following augumented functions:

In addition, you should add the following 4 lines in the "onCreate" method:

 @Override
  public void onCreate(Bundle savedInstanceState) {

    setDashboardResource(R.layout.dashboard); // (1)
    setMainWindowResource(R.layout.main); // (2)

    setDefaultRobotName(getString(R.string.default_robot)); // (3)
    setDefaultAppName(getString(R.string.default_app)); // (4)
    
    super.onCreate(savedInstanceState);

(1),(2): Please set the resource id for the view of dashboard (1) / main(2). Linear Layout view is recommended for the view of dashboard.

(3): Please set the default robot name.(ex. "turtlebot")

(4): Please set the app package path/the app name.(ex. "turtlebot_core_apps/android_teleop")

(3) and (4) are used when the application is launched independently. So if you hope that the application is used only with App Chooser, these lines aren't essential.

Dashboard is created for turtlebot and pr2, but if you would like to create a custom dashboard and use, you should add the following line.

    super.onCreate(savedInstanceState);
   
    setCustomDashboardPath(getString(R.string.custom_dashboard_path)); // (5)

(5): Please set the package path of your custom dashboard. (ex. "org.ros.android.view.customDashboard")

Adding an Android Client to Your App

Android clients are specified by their fully qualified class name. The app chooser will automatically connect to the android market when it cannot find an application client. Here is an example definition, which follows the "clients:" tag:

clients:
  - type: android
    manager:
      api-level: 10
      intent-action: org.ros.android.android_teleop.MainActivity

The "type:" line specifies that the client is an android client. The "manager:" tags provide information to the app chooser to find the application code.The "api-level:"specifies the lowest api level available. The "intent-action:" specifies the fully qualified path.

Optionally, an "app:" tag may be added:

    app:
      camera_topic: /wide_stereo/left/image_color/compressed_throttle
      base_control_topic: /cmd_vel

The "app:" tags define a set of key-value pairs for the application client. The behavior of the key-value pairs depends on the application client. We recommend that application clients use the key-value pair infrastructure to allow topic remapping.

Once you have added the tag, restart your robot's app manager and connect to it with an android device. Starting the application should launch the correct client with the correct parameters.


2018-09-15 12:19