Message Generation#

A short explanation of how to generate Java interfaces based on ROS messages (*.msg-files) without using the catkin build system.

Step 1

Set up the ros java workspace as previously described.

Step 2

Copy the required dependencies for genjava to the root. Genjava script looks for the rosjava_bootstrap in root.

RUN mkdir /root/.m2/repository/
ADD rosjava_workspace/rosjava/devel/share/repository/ /root/.m2/repository/ 

Step 3

Install the ros messages as ros packages that should be generated. For example, for moveit messages:

apt install ros-noetic-moveit-msgs

Step 4

Generate message with following command:

genjava_message_artifacts --verbose -p moveit_msgs 
  • option -p to specify package or packages to build, without the -p flag, all packages will be built

  • option -o to specify the output folder for the built packages, without -o flag, all packages are built in root

Step 5

Then navigate to the built folder, built the gradle project with:

/.gradlew generateSources