Repository Summary
Description | ROS2-compatible communication library in Java, uses Fast-DDS |
Checkout URI | https://github.com/ihmcrobotics/ihmc-ros2-library.git |
VCS Type | git |
VCS Version | develop |
Last Updated | 2025-03-20 |
Dev Status | UNKNOWN |
CI status | No Continuous Integration |
Released | UNRELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Packages
Name | Version |
---|---|
ihmc-pub-sub | 0.12.0 |
ros_msgs | 0.0.1 |
README
IHMC ROS 2 Library
ROS2 messaging for Java. Implements a ROS 2 compatible layer with a Java JNI layer on top of Fast-DDS.
Features
- Easy-to-use API for publishing and subscribing to ROS 2 topics
- Allocation free modules for realtime support
- Carries documentation from .msg files into Javadoc
- Gradle task for .msg -> .java generation
- Provided Java library for ROS common_interfaces, rcl_interfaces, and geometry2
- ROS 2 .msg to ROS 1 .msg generation
- Official ROS 2 compatibility when used with Fast-DDS middleware
Usage
This library provides a minimal implementation of a ROS 2 node in Java. Two versions are available:
- ROS2Node: Publishes in the same thread and uses direct callbacks for incoming messages.
- RealtimeROS2Node: Stores outgoing and incoming messages in a queue and uses non-blocking calls to publish messages and allows polling for new messages.
Create ROS2Node and RealtimeROS2Node with ROS2NodeBuilder:
ROS2Node ros2Node = new ROS2NodeBuilder().build("test_node");
RealtimeROS2Node realtimeROS2Node = new ROS2NodeBuilder().buildRealtime("realtime_test_node");
Gradle
dependencies {
implementation("us.ihmc:ros2-library:1.2.3")
}
Examples
See ROS2TalkerExample.java
and ROS2PublishSubscribeExample.java
.
Environment Options
| Environment Variable | Description |
|————————————-|——————————————————————–|
| ROS_DOMAIN_ID | Set the ROS 2 domain ID to use (integer, 0-101) |
| ROS_DEFAULT_QOS | QoS for topics that don’t specify it (RELIABLE
or BEST_EFFORT
) |
Note
The intermediate .idl files generated by this library are not valid to be used outside IHMC Pub/Sub.