Note: This tutorial assumes that you have completed the previous tutorials: Android Studio & Tools Download. |
![]() |
Installation - ROS Development Environment
Description: Preparing a ros environment for development.Keywords: android installation
Tutorial Level: BEGINNER
Next Tutorial: Creating Android Packages
The following instructions show how to build android libraries and reference applications from the usual ros style environment for development. |
Contents
About
This tutorial will show how to deploy and build the core android libraries and reference applications using catkin and gradle from the command line. This approach is useful for those already familiar with ROS or when building chains of libraries and applictions across multiple repositories. Also for automated continuous integration builds.
Tip : If you wish to just build a single android application on top of the existing rosjava & android libraries, you may prefer to build directly from android studio using our maven repositories as a means of pulling in the required dependencies. |
PreRequisites
Download and install the new android studio+sdk.
Rosjava build tools from deb, or from a source installation of rosjava.
> sudo apt-get install ros-indigo-rosjava-build-tools
(Optional) A workspace where you build your own message artifacts. 1
Note that a source or deb installation of rosjava is not strictly necessary - all dependencies can be retrieved from the maven repository.
Tip : If you do utilise rosjava source installation, or custom message workspace, include them as underlays to the android workspaces we will install below. |
Sources
Fat Workspace
For the full suite of official repositories:
> mkdir -p ~/android > wstool init -j4 ~/android/src https://raw.github.com/rosjava/rosjava/indigo/android_core.rosinstall # or if you want the android_apps/android remocons repos as well: # wstool init -j4 ~/android/src https://raw.github.com/rosjava/rosjava/indigo/android_apps.rosinstall > source /opt/ros/indigo/setup.bash > source ~/rosjava/devel/setup.bash > cd ~/android > catkin_make
Diet Workspace
You don't need to compile all .aar's yourself - the official .aar's exist in our maven repo which will automatically download when they are listed as a gradle dependency of your project. In this case, you can just work on your own sources (saves a great deal of compilation time!).
> mkdir -p ~/android > wstool init -j4 ~/android/src my_sources.rosinstall > source /opt/ros/indigo/setup.bash > cd ~/android > catkin_make
Usage
You can now either continue to develop in one of three ways:
On the command line with catkin_make.
Source devel/setup.bash and just run gradle in each android package.
Import your packages into android studio and use the IDE.
Testing an App
Android
Install the android_tutorial_camera app via Android Studio to your device. Refer to the Android Studio notes for instructions on how to do this and other things that will mercilessly coerce Android Studio into aligning your evil plans. Feel free to add to these.
Launch the app and connect to a pc master configured in the following way.
PC
> source ~/android/devel/setup.bash
- Start a roscore on your machine
- Launch the app on your device and enter your machine's ip when prompted
- Start the image viewer on your machine
> rosrun image_view image_view image:=camera/image _image_transport:=compressed
Creating an App
Make use rosjava_build_tools, it has a couple of catkin_create_xxx scripts which are useful.
Footnotes
You will only need a message workspace if you have your own custom messages, or are using messages that aren't built by the official rosjava_messages package (1)