Skip to content

Getting Started with Tango and ROS

shilohc edited this page Sep 4, 2014 · 3 revisions

This page explains how to set up a workspace to build ROSJava for use with the Project Tango Phone or Tablet.

Install ROS Hydro on Ubuntu

If you need to make a new installation of ROS Hydro, follow the instructions here: http://wiki.ros.org/hydro/Installation/Ubuntu

Otherwise, make sure you have the latest release of Hydro on your system.

Install Supporting Tools

You'll need catkin, ros (for the setup.bash variables), and a few message packages to ensure it all compiles. Ensure you include any other msg packages you are likely to use in your android applications.

> sudo apt-get install ros-hydro-catkin ros-hydro-ros ros-hydro-common-msgs

You will also need wstool:

> sudo apt-get install python-wstool

If that is not possible, fall back to pip:

> sudo pip install -U wstool

Install and Configure Android Studio

Follow the instructions here to download Android Studio.

When you launch Android Studio for the first time, make sure you check for upgrades, and have the latest Canary release. Version 0.5.2 will NOT work properly. At the time of this writing 0.6.1 is the latest version. Do the online update and restart. You must download version 0.6.1; older or newer versions will not work. (Issue #2)

Make sure you have the following SDK pieces for Android installed:

  • Android Tools - Android SDK Build-tools 19.1
  • Android Tools - Android SDK Build-tools 19.0.2
  • Android 4.3 (API 18) - SDK Platform
  • Android 3.2 (API 13) - SDK Platform
  • Android 2.3.3 (API 10) - SDK Platform
  • Android Support Repository
  • Android Support Library

Android Studio will attempt to put an entire copy of the Android SDK in a sub-directory of wherever you install Android Studio. If you have already been using Eclipse for Android development, or for some other reason already have the Android SDK installed, you don't need to go through the download hassle of having two copies of the SDK. When you launch Android Studio for the first time without a project open, you have the option of configuring Android Studio to use a pre-determined SDK location.

Add android-studio to your $PATH in your .bashrc, and make sure your $ANDROID_HOME is the location of your SDK in your .bashrc.

Launch Android Studio:

> studio.sh

Via the startup menu items (Configure -> Project Defaults -> Project Structure), change your Android SDK Location and the JDK location to point to the SDK. Also update your JVM location. I like to use Java 1.6.0_45 (Java HotSpot(TM) 64-Bit Server VM located in /usr/lib/jvm/default-java).

Install ROSJava and set up ROSJava Android

> mkdir -p ~/rosjava
> wstool init -j4 ~/rosjava/src https://raw.github.com/rosjava/rosjava/hydro/rosjava.rosinstall
> source /opt/ros/hydro/setup.bash
> cd ~/rosjava
> catkin_make

Now install the ROS Java Android workspace:

> mkdir -p ~/rjandroid
> wstool init -j4 ~/rjandroid/src https://raw.github.com/rosjava/rosjava/hydro/android_core.rosinstall
> source ~/rosjava/devel/setup.bash
> cd ~/rjandroid
> catkin_make

Test out your new workspace by loading a sample project into Android Studio. Launch Android Studio:

> studio.sh

Import project ~/rjandroid/src/android_core. This will import all the sample projects into Android Studio. If it throws any errors about SDKs missing, then you may have forgotten to bring in all the SDKs from earlier in this page. Open the Android SDK manager and load any missing ones. If you seem to have everything, Troubleshooting ROSTango Build Failures may help.

If everything goes correctly, it should build all the sample projects, and report a clean, complete build.

Some documentation is at:

  • ~/rjandroid/src/android_core/docs/build/html/index.html
  • ~/rjandroid/src/android_core/docs/build/html/javadoc/index.html

Building a ROSJava Android Package and Project

> source ~/rjandroid/devel/setup.bash
> mkdir -p android/src
> cd android/src
> catkin_create_android_pkg android_foo android_apps android_extras rosjava_core
> cd android_foo
> catkin_create_android_project -t 10 -p com.github.ros_java.android_foo.dude dude
> catkin_create_android_library_project -s 13 -p com.github.ros_java.android_foo.dudette dudette
> cd ../..
> catkin_make

Now you are ready to go! Import your new project into Android Studio and voila! You are ready to write some ROS nodes!

You're also ready to build the ROSTango applications and libraries, and start fooling around with publishing VIO to ROS. ROSTango Instructions