Announcing a new ROS 2 compatible Java library - jros2

jros2

A ROS 2 compatible Java library for publish-subscribe. I dare say it’s the easiest way possible to talk to other ROS 2 nodes; no local ROS 2 installation is required. All you need to do is depend on the library in your Java project (works best with Maven or Gradle).

Works on: Windows, Linux (including NVIDIA Jetson & RPi), and macOS! Android support is planned.

jros2 loosely follows rclcpp regarding API design and usage. Includes the following features:

  • Publish and subscribe to ROS 2 topic
  • Supports custom message types
  • Generate Java classes from ROS 2 .msg files
  • Fast-DDS backend
  • Minimal and fast implementation
  • Fully thread-safe
  • Async and allocation-free API
  • Full QoS configuration
  • (soon) ROS 2 services
  • (soon) ROS 2 actions
  • (soon) ROS 2 parameters

jros2 is recommended with javacpp-presets packages such as opencv, librealsense2, cuda! Check out javacpp-presets; they make developing robotics & computer vision software very easy in Java!

This project was developed to fill a requirement at IHMC Robotics, we write a lot of our robotics software in Java. If there’s something you’d like to see in jros2, please make an issue on GitHub!

2 Likes

Why isn’t this library built on top of rclc?

Good question. I think the answer is a mix of things but it mostly boils down to having more control of the implementation in Java.

1 Like

You mean more bugs/non-canonical behavior? :smiley:

I believe it is easier to start from scratch, but in the long run I guess turning this into a rclc-based library (via JNI) would save you effort.

No, more like removing bloat and unnecessary layers. Also, vastly simplifying the building and distribution.

The goal is to be wire-compatible with ROS 2, not to be a 100% complete implementation. This happened to be a general enough project within our research organization that it was open sourced and branded as something others can use.

Perhaps someone could eventually do an rcljava, but this project isn’t going to be that.

1 Like

rcljava does exist already :slightly_smiling_face: GitHub - ros2-java/ros2_java: Java and Android bindings for ROS2

Though it’s been a long time since I did much work on it, so if anyone wants to pick it up and maintain it, please let me know.

One person’s bloat is another person’s software architecture :wink:

2 Likes

A large part of the reason for this project was to decouple from having a ROS 2 installation. ros2_java seems good, but it has a lot of requirements