Giter VIP home page Giter VIP logo

ros2_java's Introduction

ROS2 for Java

Build status

JRE Build Status

Android Build Status

Introduction

This is a set of projects (bindings, code generator, examples and more) that enables developers to write ROS2 applications for the JVM and Android.

Besides this repository itself, there's also:

Is this Java only?

No, any language that targets the JVM can be used to write ROS2 applications.

Including Android?

Yep! Make sure to use Fast-RTPS as your DDS vendor and at least this revision.

Features

The current set of features include:

  • Generation of all builtin and complex ROS types, including arrays, strings, nested types, constants, etc.
  • Support for publishers and subscriptions
  • Tunable Quality of Service (e.g. lossy networks, reliable delivery, etc.)
  • Clients and services
  • Timers
  • Composition (i.e. more than one node per process)
  • Time handling (system and steady, ROS time not yet supported ros2/ros2#350)
  • Support for Android
  • Parameters services and clients (both asynchronous and synchronous)

Sounds great, how can I try this out?

First of all, download the ament repositories in a separate workspace:

mkdir -p ~/ament_ws/src
cd ~/ament_ws
wget https://raw.githubusercontent.com/esteve/ament_java/master/ament_java.repos
vcs import ~/ament_ws/src < ament_java.repos
src/ament/ament_tools/scripts/ament.py build --symlink-install --isolated

We need to split the build process between Ament and the rest of ros2_java workspace so that the additional build type for Gradle projects is picked up by Ament.

Make sure you have Gradle 3.2 (or later) installed. Ubuntu 16.04 ships with Gradle 2.10, you can install a more recent version of Gradle from the following PPA:

$ sudo add-apt-repository ppa:cwchien/gradle
$ sudo apt install -y gradle

The following sections deal with building the ros2_java codebase for the desktop Java runtime and for Android.

Desktop

mkdir -p ~/ros2_java_ws/src
cd ~/ros2_java_ws
wget https://raw.githubusercontent.com/esteve/ros2_java/master/ros2_java_desktop.repos
vcs import ~/ros2_java_ws/src < ros2_java_desktop.repos
cd ~/ros2_java_ws/src/ros2/rosidl_typesupport
patch -p1 < ../../ros2_java/ros2_java/rosidl_typesupport_ros2_java.patch
cd ~/ros2_java_ws
. ~/ament_ws/install_isolated/local_setup.sh
ament build --symlink-install --isolated

Now you can just run a bunch of examples, head over to https://github.com/esteve/ros2_java_examples for more information.

Android

The Android setup is slightly more complex, you'll need the SDK and NDK installed, and an Android device where you can run the examples.

Make sure to download at least the SDK for Android Lollipop (or greater), the examples require the API level 21 at least and NDK 14.

You may download the Android NDK from the official website, let's assume you've downloaded 15c (the latest stable version as of 2017-11-07) and you unpack it to ~/android_ndk

mkdir -p ~/ros2_android_ws/src
cd ~/ros2_android_ws
wget https://raw.githubusercontent.com/esteve/ros2_java/master/ros2_java_android.repos
vcs import ~/ros2_android_ws/src < ros2_java_android.repos
cd ~/ros2_android_ws/src/ros2/rosidl
touch python_cmake_module/AMENT_IGNORE
touch rosidl_generator_py/AMENT_IGNORE
cd ~/ros2_android_ws/src/ros2/rosidl_typesupport
patch -p1 < ../../ros2_java/ros2_java/rosidl_typesupport_ros2_android.patch
cd ~/ros2_android_ws
. ~/ament_ws/install_isolated/local_setup.sh
ament build --isolated --cmake-args \
  -DPYTHON_EXECUTABLE=/usr/bin/python3 \
  -DCMAKE_TOOLCHAIN_FILE=$HOME/android_ndk/android-ndk-r15c/build/cmake/android.toolchain.cmake \
  -DANDROID_FUNCTION_LEVEL_LINKING=OFF \
  -DANDROID_NATIVE_API_LEVEL=android-21 \
  -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang \
  -DANDROID_STL=gnustl_shared \
  -DANDROID_ABI=armeabi-v7a \
  -DANDROID_NDK=$HOME/android_ndk/android-ndk-r15c \
  -DTHIRDPARTY=ON \
  -DCOMPILE_EXAMPLES=OFF \
  -DCMAKE_FIND_ROOT_PATH="$HOME/ament_ws/install_isolated;$HOME/ros2_android_ws/install_isolated" \
  -- \
  --parallel \
  --ament-gradle-args \
  -Pament.android_stl=gnustl_shared -Pament.android_abi=armeabi-v7a -Pament.android_ndk=$HOME/android_ndk/android-ndk-r15c --

You can find more information about the Android examples at https://github.com/esteve/ros2_android_examples

ros2_java's People

Contributors

esteve avatar konczg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.