Revision 20 as of 2015-02-20 06:11:32

Clear message

Overview

The following instructions show how to build a (mostly) self-contained catkin-ros-java source workspace that can either be extended or used as an underlay by your own sources.


This installation type is typically only necessary if you are doing catkin-rosjava development at the official stacks level, but also enlightening if trying out various things with rosjava. Note that it wouldn't take much to extend this to a completely self-contained installation, you just need to add a few sources to the rosinstall file. For now, we use rosdep to pull in a few and only include those necessary to build rosjava and generate the core message artifacts.

Prerequisites

Get the basics.

> sudo apt-get install ros-indigo-catkin ros-indigo-rospack python-wstool

Sources

Core Sources

> mkdir -p ~/rosjava
> wstool init -j4 ~/rosjava/src https://raw.githubusercontent.com/rosjava/rosjava/indigo/rosjava.rosinstall
> source /opt/ros/indigo/setup.bash
> cd ~/rosjava
# Make sure we've got all rosdeps and msg packages.
> rosdep update
> rosdep install --from-paths src -i -y -r
# Ignore warnings re rosjava_messages (we include all msg packages explicitly here)
> catkin_make

Other Sources

Some other sources that might be of interest:

  • rocon-rosjava - rocon_msgs, uuid_msgs, yocs_msgs, rocon_rosjava_core.

Apply these to the existing workspace. For example:

> cd ~/rosjava/src
# Applying a full rosinstall
> wstool merge https://raw.githubusercontent.com/yujinrobot/yujin_tools/master/rosinstalls/indigo/rocon_rosjava.rosinstall
# Applying a single repo
> wstool set ar_track_alvar_msgs --git https://github.com/sniekum/ar_track_alvar_msgs --version=indigo-devel

OR (more conveniently), apply it as an overlay. For example:

> mkdir -p ~/myjava/src
> cd ~/myjava/src
> wstool init -j4 https://raw.githubusercontent.com/yujinrobot/yujin_tools/master/rosinstalls/indigo/rocon_rosjava.rosinstall
> source ~/rosjava/devel/setup.bash
> cd ~/myjava
# Make sure we've got all rosdeps and msg packages.
> rosdep update
> rosdep install --from-paths src -i -y
> catkin_make

Your Own Sources

You can now proceed to add your own source packages on top, either by merging with the same workspace or creating an overlay as shown above. You're now ready to start developing a shiny new catkin-rosjava package! Refer to the next tutorial on how to do that.

Working with Catkin-Rosjava Workspaces

ToCatkin or ToGradle?

Once you've got a workspace compiled, you can then continue to compile your projects in one of two ways:

  • Entire Workspaces: on the command line with catkin_make, but this takes ages!

  • Individual Projects/Targets: source devel/setup.bash and work with the gradle wrappers at the root of each project/subproject, much faster.

Working directly with gradle is like using make under the hood of a catkin_make build for c++. For example:

> cd ~/rosjava/src/rosjava_core
# To build the default targets
> ./gradlew
# OR for specific targets, e.g. to build all artifacts
> ./gradlew clean
> ./gradlew publishMavenJavaPublicationToMavenRepository
# To build a specific subproject
> cd ~/rosjava/src/rosjava_core/rosjava
> ./gradlew

Maven Artifacts

In this installation, you will find all your maven artifacts get dumped in a local maven repository at ~/rosjava/devel/share/maven.