Creating an Android-enabled Robot Operating System Embedded Cluster
The economy and capability of Android devices paired with the Robot Operating System (ROS) software framework is a very powerful combination for building distributed robotics applications.
For example, you could create an autonomous lawn-care robot controlled by a master board (like a Raspberry Pi or Intel Edison), that coordinates sensor gathering from low-cost Android devices, pulls sensor readings from LIDAR scanners or image systems, and puts it all together to understand its environment and take action.
This high-level guide walks through setting up an embedded development board with a full installation of Robot Operating System, then an ROS-enabled Android development environment on a computer, and finally a simple ROS subscriber (residing on the board) that listens to sensor data published to ROS topics by an ROS-enabled Android application.
Pieces of the Puzzle
- A development board (Guide uses Intel Edison. Raspberry Pi should work even better, but you’re on your own for setup)
- An Android device
- A computer (for development)
The application that will run the robot can be thought of as a collection of scripts (called “nodes”) that communicate with each other to accomplish a task. A node can exist on any connected device in a cluster.
The End Goal
The setup this guide creates is a single development board which runs the Robot Operating System master and a subscriber node, as well as an Android application that acts as a connected publisher node. As a side-effect of this guide, you will have a complete Android development environment on a computer, and a complete ROS development environment located on the board itself.
The example software we will be running is an Android application that “publishes” sensor data that it collects to ROS “topics”, which is how ROS segments “messages”. The subscriber node “subscribes” to the topics that the Android app publishes to.
Since the subscriber node knows the format of the messages in the topics that it subscribes to, it can immediately use those data structures to complete further activities (those further activities are beyond the scope of this guide).
These are the things we need to accomplish:
- Install an ROS-compatible distribution of Linux on a board
- Install and configure ROS on a board
- Install an Android development environment on a computer
- Compile and install the Android app onto a device
- Compile and run the board-based ROS nodes
- Watch as sensor readings appear on the board from the device!
Configure the Development Board
Installing a Compatible Version of Linux
To install Robot Operating System on the Intel Edison, the board needs to be flashed with a more fully-featured distribution of Linux.
Follow this guide to install Ubilinux onto your Edison board.
Install Robot Operating System
Installing and Configuring Robot Operating System on Ubilinux Edison
Installing and properly configuring Robot Operating System on Ubilinux Edison can be a very challenging task. A guide has been created to walk you through the process, and some installation scripts are provided that may make the process quite smooth. If the scripts do not fully install and configure ROS, then see the source code of the scripts to see what needs to be done and what is going wrong.
Follow this guide to install ROS onto your Ubilinux Edison board.
Set Up Android Development
Creating an ROS-enabled Android Environment and Subscriber Application
Android development can be tricky to get started with, let alone integrating Robot Operating System into an application.
A pre-configured development environment and sample ROS-enabled applications are available on Github and a guide to installing the environment and using it is published on Medium.
The technical details: Needed ROS building blocks are pulled down from Maven, builds are orchestrated with Gradle, and Android API 15 is targeted to allow broad support and Mac OS X development capability.
Follow this guide to set up Android Development on a computer.
Phew! That was a lot of work. With all of that out of the way, let’s see how to use our new set up:
Putting It All Together
Developing For and Using the ROS/Android Cluster
The best way to develop ROS nodes that should reside on the development board is to mount the board over SFTP with an application like Cyberduck. This lets you edit and sync files on the development board via a computer over Wifi.
- Connect your computer and board to the same wifi network
- Get your board’s IP address (run ‘ifconfig’ and get the inet address under wlan0)
- Create a new bookmark on Cyberduck. Add the IP address.
- Set the username to root and password to Edison
To start Robot Operating system, run:
And leave that running while you want your nodes to work. In a separate terminal or process, to start the sample Android app subscriber that will output selected sensor readings from the app run:
rosrun beginner_tutorials android_subscriber.py
To send sensor readings to the ROS master, and therefore to the subscriber to output them to the screen, install the android_sensors_driver sample app onto an Android device. Set the device to the same wifi network as the board. Get the IP address of the board.
Then input the IP address and default port (11311) into the text field of the Android application. Here’s an example completed address:
With all of those running and connected you should see sensor readings streaming on the console that you ran the android_subscriber on!