Skip to content
Proyek

Tentang

The easiest way to use ROS 2 from Java and on Android

AI dan pembelajaran mesin

Cara angka ini diukur

Yang dapat Anda lakukan

  • Fully compatible with ROS 2 foxy or newer
  • Does not require a ROS 2 installation on the system
  • Ready-to-use Java library, just add to your Maven or Gradle dependencies!
  • Publish and subscribe to ROS 2 topics

Pertumbuhan bintang terukur

dalam 24 jam
0
dalam 7 hari
+1
dalam 15 hari
Mengumpulkan riwayat
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli


Wiki Issues

Donate here to fund open-source robotics projects!


A ROS 2 library for Java. Uses Fast-DDS middleware. Fully compatible with other supported ROS 2 DDS middlewares.

Fast-DDS version: 3.6.2

ROS 2 compatible and tested distros: [foxy, humble, jazzy, kilted, lyrical]

Supported platforms:

  • Linux (Ubuntu 20.04+ or similar x86_64, arm64, armhf)
  • Windows (Windows 10+ x86_64, ARM64)
  • macOS (macOS 13+ Intel, Apple Silicon)
  • Android (Android 12+ x86_64, arm64-v8a, armeabi-v7a)

Works on NVIDIA Jetson and all versions of Raspberry Pi!

Features

  • Fully compatible with ROS 2 foxy or newer
  • Does not require a ROS 2 installation on the system
  • Ready-to-use Java library, just add to your Maven or Gradle dependencies!
  • Publish and subscribe to ROS 2 topics
  • 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
  • (soon) ROS 2 services
  • (soon) ROS 2 actions
  • (soon) ROS 2 parameters

Usage

Read in-depth documentation on the Wiki!

Gradle

Add the repository in settings.gradle.kts:

dependencyResolutionManagement {
    repositories {
        mavenCentral()
        maven {
            url = uri("https://robotlabfiles.ihmc.us/repository/")
        }
    }
}

Add the dependency in build.gradle.kts:

dependencies {
  implementation("us.ihmc:jros2:1.5.1")
}

Maven

Add the repository in pom.xml:

<repositories>
  <repository>
    <id>ihmc-repo</id>
    <url>https://robotlabfiles.ihmc.us/repository/</url>
  </repository>
</repositories>

Add the dependency:

<dependencies>
  <dependency>
    <groupId>us.ihmc</groupId>
    <artifactId>jros2</artifactId>
    <version>1.5.1</version>
  </dependency>
</dependencies>

Android

jros2 fully supports Android! Add the repository and dependency in your Android project:

Add the repository in settings.gradle.kts:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://robotlabfiles.ihmc.us/repository/")
        }
    }
}

Add the dependency in your app's build.gradle.kts:

dependencies {
    implementation("us.ihmc:jros2-android:1.5.1")
}

See the Android Support Wiki for complete setup instructions and examples.

Here's the basics:

Create a ROS2Node:

int domainId = 100;
ROS2Node node = new ROS2Node("my_node", domainId); // domainId is 0 by default
// Call node.close() when you're done with the node!

Create a ROS2Topic:

ROS2Topic<Int32> intTopic = new ROS2Topic("/int_topic", Int32.class);

Create a ROS2Publisher and publish a message on the intTopic:

ROS2Publisher<Int32> intPublisher = node.createPublisher(intTopic);
Int32 message = new Int32();
message.setData(123);
intPublisher.publish(message);

Create a subscription to the intTopic:

ROS2Subscription<Int32> subscription = node.createSubscription(intTopic, reader -> {
  Int32 message = reader.read();
  // Do something with the message!
};

Talker and listener example

Run a talker and listener example with ./scripts/run_talker_listener.sh. If you have a local ROS 2 installation or use a ROS 2 container, you can verify that ROS 2 is able to communicate with jros2.

[New shell]
jros2$ ./scripts/run_talker_listener.sh
> Task :examples:ros2-ros2-talker-listener:run
Publishing: 'Hello world: 0'
Publishing: 'Hello world: 1'
I heard: 'Hello world: 1'
Publishing: 'Hello world: 2'
I heard: 'Hello world: 2'
[...]
[New shell]
jros2$ source /opt/ros/humble/setup.bash 
jros2$ ros2 topic echo /chatter
data: 'Hello world: 1'
---
data: 'Hello world: 2'
---
[...]

Jelajahi proyek terkait

Memuat…