Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Java project demonstrating how to create and use a jar library from custom messages and services in ROS Java. No ROS installation required.

License

NotificationsYou must be signed in to change notification settings

SpyrosKou/Custom-Messages-ROS-Java-System-Example

Repository files navigation

This is an example ROS system that demonstrates the usage ofcustom ROS topic messages andcustom ROS Service definitions.The example runs completely on Java with no ROS instalation required.The example demonstrates running a roscore and four rosjava ROS nodes that usecustom ROS messages using the ROS Java roscore.ROS Java contains a plain java, standalone version of roscore that does not require any ROS instalation to be present.

In this repository, a Topic Publisher, a ROS Topic Subscriber, a ROS Service Server and a Service Client are created using the custom ROS messages.A version of this repository that uses predefined ROS messages only is availablehere.This repository builds on top of the aforementionedPlain ROS Java System Example.

This example project demonstrates how to do the followingprogrammatically through the ROS Java API:

  1. Create and use areusable java jar library with the generated ROS Java definitions forcustom ROS messages
  2. Publish and subscribe to a ROS topic that is created with acustom ROS topic message.
  3. Create a ROS Service Server and call it from a ROS Service Client that is created with acustom ROS service definition.
  4. Create, start and shutdown the Java roscore
  5. Create, start and shutdown ROS nodes

This repository also provides an example that demonstrates how to run rosjava with an another roscore. E.g. cpp roscore fromROS noetic.

Project Modules

This module creates java library jar with acustom Ros Topic Message and acustom ROS Service definition.
The custom ROS Topic message also demonstrates how to use predefined ROS messages, by using as an example thesensor_msgs/JointState.

This module uses thecustom-ros-messages module to implement aservice/client andpublisher/subcriber examples.

Requirements

In order to compile and run this project only Java needs to be installed.GIT also makes getting the source very easy. Links are provided for convenience.

  • GIT , in order to clone theproject repository
  • JDK, theproject has been developed and tested usingJDK 17
  • Gradle, is used for project compilation. Installing it is not required. Following the instructions below will automatically download gradle 7.5 and ignore any existing installation.

Quick Instructions for WindowsPower Shell

  1. Clone theproject repository:git clone https://github.com/SpyrosKou/Custom-Messages-ROS-Java-System-Example.git

  2. Go into the cloned repository directory:cd .\Custom-Messages-ROS-Java-System-Example\

  3. Compile the project and prepare for running:gradlew installDist

  4. Build and run in a single command using thegradle application plugin:gradlew run

Quick Instructions for Linux

  1. Clone theproject repository:git clone https://github.com/SpyrosKou/Custom-Messages-ROS-Java-System-Example.git

  2. Go into the cloned repository directory:cd Custom-Messages-ROS-Java-System-Example/

  3. Add execute permission to gradlew script:sudo chmod +x gradlew

  4. Compile the project and install it locally:gradlew installDist

  5. Build and run in a single command using using thegradle application plugin:gradlew run

Using with an existing, external, non-rosjava roscore

It is possible to use rosjava to run rosjava nodes in an environment where a ros system is already running. E.g. a cpp noetic ros instance.An example on how to run rosjava nodes programmatically without starting roscore is provided inMainExternalNote that if a roscore is not running, then this example will not run correctly.In order to use it do the following:

  1. SetROS_MASTER_URI andROS_IP environment variables. Both these variables are needed. If these environment variables are missing, you will see some errors in step 4 below.The following commands assumes the example and roscore run in127.0.0.1 akalocalhost.
    export ROS_MASTER_URI=http://127.0.0.1:11311
    export ROS_IP=http://127.0.0.1:11311

  2. Start roscoreRun the following:roscore

  3. With the roscore already started externaly runMainExternal

  4. You can start directly theMainExternal from the gradle by running:./gradlew runWithExternalRos

About

A Java project demonstrating how to create and use a jar library from custom messages and services in ROS Java. No ROS installation required.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp