Note: This tutorial assumes that you have completed the previous tutorials: Android Studio & Tools Download.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

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.


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

sudo apt-get install ros-kinetic-rosjava-build-tools

Ros Android Sources

Core Sources

The following provides the core android libraries:

> mkdir -p ~/android_core
> wstool init -j4 ~/android_core/src https://raw.github.com/rosjava/rosjava/kinetic/android_core.rosinstall
> source /opt/ros/kinetic/setup.bash
> # You only need to do the next step if you opted for a source installation of rosjava:
> source ~/rosjava/devel/setup.bash
> cd ~/android_core
> catkin_make

Your Own Sources

I split the workspaces here into two - one is a strictly java workspace and the other an android workspace so that the android workspace doesn't slow down your work in the java workspace. The java workspace is typically where you can build custom message artifacts from your own message sources as well as build java algorithms for use inside your android applications (building/testing in java, especially for your ros connections is far easier than doing it for android).

> sudo apt-get install ros-kinetic-rosjava-build-tools ros-kinetic-genjava
> mkdir -p ~/myjava
> wstool init -j4 ~/myjava/src my_java_sources.rosinstall
> mkdir -p ~/myandroid
> wstool init -j4 ~/myandroid/src my_android_sources.rosinstall
> source /opt/ros/kinetic/setup.bash
> cd ~/myjava; catkin_make
> source ~/myjava/devel/setup.bash
> cd ~/myandroid; catkin_make

If you don't have any rosinstalls yet, just do a wstool init ~/myjava/src;wstool init ~/myandroid/src to init the workspaces instead.

Testing

Core Library Application

PC:

In a first shell:

> source /opt/ros/kinetic/setup.bash
# Set ROS_IP with your pc's ip
> export ROS_IP=192.168.1.101
> roscore

In a second shell:

> sudo apt-get install ros-kinetic-image-view ros-kinetic-rqt-image-view ros-kinetic-image-transport-plugins
> source /opt/ros/kinetic/setup.bash
# Set ROS_IP with your pc's ip
> export ROS_IP=192.168.1.101
> rqt_image_view
# OR
> rosrun image_view image_view image:=/camera/image _image_transport:=compressed

See the Network Setup notes for more information about ROS_IP.

Android

This requires the android_core sources.

> source ~/android_core/devel/setup.bash
> /opt/android-studio/bin/studio.sh
  • Import the ~/android_core/src/android_core project.

  • Plug in your phone to your pc by usb
  • Connect the phone to your wireless network
  • In the toolbar configurations dropdown, select android_tutorial_camera

  • Hit the right arrow next to this to build/deploy and launch the configuration.
  • Enter your machine's ip when prompted

Where to Now?

You're now ready to start developing shiny new android applications! Refer to the next tutorial on how to do that.

Footnotes

Wiki: android/Tutorials/kinetic/Installation - ROS Development Environment (last edited 2016-12-27 10:52:53 by jcerruti)