This is an old revision of the document!


Migrating to the catkinized version of KnowRob

Starting from ROS hydro/indigo, KnowRob has switched to the catkin buildsystem and the 'new' rosjava. This page explains the steps that are needed for transforming packages that have been built for the old version to the new KnowRob.

Catkinization

As a first step, you can use the 'catkinize' scripts that generate something like a valid catkin package from your rosbuild packages. The following manual steps are then

Converting Java packages

Rosjava uses the gradle builsystem that is at the moment (07/2014) only loosely integrated with catkin. Therefore, some things like dependencies need to be specified multiple times. Make sure to read the official documentation in the ROS wiki as well as the rosjava_core Sphinx documentation carefully to understand the main concepts first.

Package structure

There is a one-to-many relation between catkin packages and rosjava sub-projects as described here. This structure has been adopted in KnowRob: In each KnowRob package that contains Java code, there is a folder with the same name containing the respective rosjava subproject. In case the package requires custom messages, there is another subfolder with the name of the message package. For example, the json_prolog package (depending on the service defined in json_prolog_msgs) looks like this:

  json_prolog_msgs        <-- catkin package
    |- srv
    |- package.xml
    \- ...
    
  json_prolog             <-- catkin package
    |- gradle             <-- gradle wrapper needed for compiling the rosjava code
    |- json_prolog        <-- rosjava subproject
    |     |- src        
    |     \- build.gradle
    |
    |- json_prolog_msgs   <-- rosjava subproject for the custom service definitions
    |     \- build.gradle
    |
    |- build.gradle
    |- gradlew
    |- package.xml
    \- ...

JAR files and dependencies

Rosjava is now based on Maven that 'magically' maintains jar files for dependendies. The following snippet explains how dependencies are specified in the build.gradle of the respective subproject:

  dependencies {
    /* Dependency on a rosjava project in the same catkin package */ 
    compile project(':json_prolog_msgs')
    
    /* Dependency on a rosjava project in another catkin package */
    compile 'org.ros.rosjava_core:rosjava:[0.1,)'

    /* Dependency on external jar files (will be downloaded from mavencentral */
    compile 'net.sf.json-lib:json-lib:2.4:jdk15'
  }

You can use the service at http://gradleplease.appspot.com/ to generate the lines to be put into the build.gradle

Adapting OWL and Prolog files to the new libraries

  • Replace all references to 'ias_knowledge_base' with knowrob_common. Please also check for other package names that may have changed.
  • Rename all *.owl.in and *.pl.in files into *.owl and *.pl. Replace the @LOCAL_PACKAGE_PATH@ (or similar) directives with URLs of the form package:<ros_pkg_name>/local/path/to/file.owl, e.g. package:knowrob_common/owl/knowrob.owl. This new syntax works for loading OWL files both from OWL and Prolog files.
  • Remove the 'false, false, true' arguments from all owl_parse() statements. The new syntax is simply
  owl_parse('package://<ros_pkg_name>/local/path/to/file.owl').
  • Update launch files to the new json_prolog interface:
  <launch>
     <param name="initial_package" type="string" value="<pkg_name>" />
     <param name="initial_goal" type="string" value="owl_parse('package://<pkg_name>/owl/file.owl')" />
     
     <node name="json_prolog" pkg="json_prolog" type="json_prolog_node" cwd="node" output="screen" />
  </launch>

Changelog

The changes have been ticketed at the knowrob repository for Milestone 1. Please have a look here for a list of changes: https://github.com/knowrob/knowrob/issues?milestone=1