Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker for Java message generation #255

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions iiwa_msgs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rosjava_messages
10 changes: 4 additions & 6 deletions iiwa_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ project(iiwa_msgs)

find_package(catkin REQUIRED COMPONENTS
actionlib_msgs
message_generation
cmake_modules
geometry_msgs
std_msgs
)
message_generation
std_msgs)

# Declare the message files to be built
add_message_files(DIRECTORY msg)
add_service_files(DIRECTORY srv)
add_action_files(DIRECTORY action)

# Actually generate the language-specific message and service files
generate_messages(DEPENDENCIES std_msgs geometry_msgs actionlib_msgs)
generate_messages(DEPENDENCIES actionlib_msgs geometry_msgs std_msgs)

catkin_package(CATKIN_DEPENDS message_runtime std_msgs geometry_msgs)
catkin_package(CATKIN_DEPENDS actionlib_msgs geometry_msgs message_runtime std_msgs )
26 changes: 26 additions & 0 deletions iiwa_msgs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM ros:kinetic-ros-base

# use bash to be able to source the ros files
SHELL ["/bin/bash", "-c"]

# upgrade ros packages
RUN apt-get update && \
apt-get install --only-upgrade ros-kinetic-* -y && \
apt-get install python-wstool -y

# setup catkin_ws for java 6 message generation
RUN mkdir -p /catkin_ws
WORKDIR /catkin_ws
RUN source /ros_entrypoint.sh && \
wstool init src && \
wstool set -y -t src genjava --git https://github.com/Tuebel/genjava.git --version=kinetic_java6 && \
wstool update -t src && \
rosdep install --from-paths src --ignore-src -r -y && \
catkin_make

# add and generate the message.
ADD . /catkin_ws/src/iiwa_msgs

# disbale message generation for all but java if using catkin_make.
# note that the jars generated via catkin_make seem to be empty
# ENV ROS_LANG_DISABLE "gencpp;geneus;genlisp;gennodejs;genpy"
27 changes: 27 additions & 0 deletions iiwa_msgs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Message Generation

# CPP, Python, ...
These messages should be automatically generated when calling `catkin_make` or `catkin build` in the workspace.

## Java Messages - Docker
Since genjava has only support for Kinetic and earlier versions of ROS, a DOCKERFILE has been written.
Specifically, we use a fork of the genjava package which will generate the messages for Java 6, which is the latest Sunrise supports.
This file can be used to setup the build environment on any system that supports Docker.
To build the DOCKERFILE simply **navigate to this directory** in a shell and call:
```bash
docker build --tag iiwa_msgs:latest .
```

Now, the messages can be generated and copied to the host.
```bash
docker run --name iiwa_msgs -it iiwa_msgs:latest /bin/bash -c \
"source devel/setup.bash && \
genjava_message_artifacts --verbose -p iiwa_msgs actionlib_msgs geometry_msgs std_msgs"
docker cp iiwa_msgs:/catkin_ws/devel/share/maven/org/ros/rosjava_messages rosjava_messages
docker rm iiwa_msgs
```

The generated files will end up in a directory called `rosjava_messages` in your current directory.
In the leaf directories you will find the .jar files which can be copied to `iiwa_ros_java/ROSJavaLib`.
Make sure to replace all four files since they depend on each other.
In the Sunrise Workbench, refresh the files view and edit the build path: remove the old versions and add the new versions from ROSJavaLib.
8 changes: 5 additions & 3 deletions iiwa_msgs/package.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<package format="2">
<name>iiwa_msgs</name>
<name>iiwa_msgs</name>
<version>2.3.1</version>
<description>ROS Messages to communicate with a KUKA LBR IIWA Robot</description>
<author email="salvo.virga@tum.de">Salvo Virga</author>
Expand All @@ -11,8 +11,10 @@
<buildtool_depend>catkin</buildtool_depend>

<depend>actionlib_msgs</depend>
<depend>message_generation</depend>
<depend>message_runtime</depend>
<depend>std_msgs</depend>
<depend>geometry_msgs</depend>

<build_depend>message_generation</build_depend>

<exec_depend>message_runtime</exec_depend>
</package>