[Documentation] [TitleIndex] [WordIndex

Introduction

This package allows creating ROS nodes for Android phones. At the current stage only Python is supported, i.e. rospy is fully working on the phone. By running the ROS nodes in the SL4A (Scripting Layer for Android) environment, one can access the most important Android functions and sensor datas without great effort.

Pre-Requirements

In order to run ROS on Android, you have to install Python for Android and for easy API access Scripting Layer for Android.

This can be done either by running our Makefile or manually:


Verify correct installation

After the setup, Python should be ready to run on your device. You can verify the successfull installation either by starting SL4A and executing one of the Python example files or by starting Python on your device via adb shell:
Open up a terminal on your PC, have your Android device connected to it.

 $ sudo adb start-server
 $ adb shell

Now you can work on the device's shell from the PC and try to execute Python on it:

PYTHONPATH=/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynload
PYTHONPATH=${PYTHONPATH}:/mnt/sdcard/com.googlecode.pythonforandroid/extras/python
export PYTHONPATH
export PYTHONHOME=/data/data/com.googlecode.pythonforandroid/files/python
export LD_LIBRARY_PATH=/data/data/com.googlecode.pythonforandroid/files/python/lib
/data/data/com.googlecode.pythonforandroid/files/python/bin/python

This should show something like this:

 Python 2.6.2 (r262:71600, Feb 14 2011, 10:32:30) 
 [GCC 4.4.3] on linux-armv7l
 Type "help", "copyright", "credits" or "license" for more information.
 >>>



Get ROScore running on Android

At the moment a simple Makefile invoking adb commands takes over the installation. In the near future, we will provide an installer that takes over the installation of the basic ROS environment and the depended Python modules.

Please set ADB variable to your adb executable or make sure that adb is in your PATH. We can distinguish the installation




Currently supported ROS packages and Python modules

ROS packages

The following packages are supported and automatically installed at the moment:

Currently we only push the ROS package's Python code and messages to the phone. But in the next few releases we will add support for Manifest.xml and thus the installation of ROS Packages on Android will be similar to the normal installation on the PC.

Python modules

Almost all common Python modules are now shipped directly with Python for Android. We additionally install:

Attention: Some OpenCV functions may be corrupt or missing. But up to now everything worked fine for us.

To get an impression how an Android ROS node could look like, simply take a look at our sample ROS node (ros.py).

Run our sample ROS node (ros.py)

If no errors occurred during the installation, our provided sample ROS node can be started.


Now /android ROS node should exists. Feel free to test the following topics:

Publishers:

 rostopic echo /mobile/acceleration   - this is a std_msgs/String
 rostopic echo /mobile/image          - this is a sensor_msgs/Image

Subscribers:

 rostopic pub /mobile/say std_msgs/String "Hello World."
 rostopic pub /mobile/vibrate std_msgs/Int16 1000
 rostopic pub /mobile/request_images std_msgs/Int16 4

The image on /mobile/image is only published after a request on /mobile/request_images (std_msgs/Int16), which holds the number of requested images.

Screenshots of the GUI

alt ROS_MASTER_URI selection dialog at startup. alt Console output of the running ROS node.

Create your own ROS node

Simply develop your ROS node using rospy and the provided packages and push it to SL4A's script directory on the Android device:

 adb push my_own_ros_node.py /mnt/sdcard/sl4a/scripts/

After pushing it to the device, you can execute it directly from SL4A.

For interacting with the Android API, you can use the provided API from SL4A:


Tested devices


2022-05-28 12:26