Categories
JAVA Programming Robotics

How to setup a ROS Java System in Windows

Setting up a plain ROS Java system that can run in Windows or Linux with no ROS installation.

ROS Java contains a plain java, standalone version of roscore that does not require any ROS installation to be present. This article describes an example ROS system running completely on Java with no ROS installation required. This example demonstrates running a roscore and two nodes. A java publisher and a java subscriber. This example project demonstrates how to do the following programmatically through the ROS Java API:

  1. Create, start and shutdown the Java roscore
  2. Create, start and shutdown ROS nodes
  3. Publish and subscribe to a ROS topic

Advantages

In a plain ROS Java System there is no need to add the ROS message (actions, services and messages) types that will be used by the different nodes in the system.

Requirements

In order to compile and run this project only jave needs to be installed. GIT also makes getting the source of the example very easy. Links and instructions are provided for convenience. Requirements:

  • GIT , in order to clone the project repository
  • JDK, it is recommended to run the project in JDK17, but other JDKs will probably work.
  • Gradle, is used for project compilation. Installing it is not required. Following the instructions below will automatically download and use a standalone gradle copy, that will be used only for this project.

Quick Instructions for Windows Power Shell

  1. Clone the project repository: git clone https://github.com/SpyrosKou/Plain-ROS-Java-System-Example.git
  2. Go into the cloned repository directory: cd .\Plain-ROS-Java-System-Example\
  3. Compile the project and prepare for running: gradlew installDist
  4. Run the project using the generated script: .\build\install\Plain-ROS-Java-System-Example\bin\Plain-ROS-Java-System-Example.bat

Quick Instructions for Linux

  1. Clone the project repository: git clone https://github.com/SpyrosKou/Plain-ROS-Java-System-Example.git
  2. Go into the cloned repository directory: cd Plain-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. Run the project using the generated script: ./build/install/Plain-ROS-Ja-System-Example/bin/Plain-ROS-Java-System-Example

Source Code

The source code is available in Github. This article has been created as while ROS Java has proven it usage by successfully being used in robotics projects, the majority of the available ROS documentation concerns is focused in ROS C/C++ and not Java.