This is an old revision of the document!


Semantic environment map in CRAM

Description: This tutorial demonstrates how to use the semantic environment map published by Knowrob within CRAM. Such map has semantically annotated objects of robot's environment, mostly the furniture in indoor scenarios or landmarks outdoors. This tutorial shows how to load the map, how to query for specific parts thereof and how to build and resolve location designators using the semantic map.

Prerequisites: To be able to follow this tutorial you need the following packages in your ROS workspace, compiled without errors:

If you installed CRAM using the official installation instructions you should have everything already. Otherwise, clone the listed repos, install the missing system dependencies with rosdep install and catkin_make your workspace.

Setting up

Step 1: start publishing the semantic environment map through JSON Prolog and TF etc.

In a fresh terminal:

$ roslaunch iai_maps iai_maps.launch

Step 2: visualization setup

In a separate terminal:

$ rosrun rviz rviz

The recommended RViz setup is shown below:

Pay attention especially at the tf_prefix of the RobotModel.

Depending on the version of your map you might also have an additional table there but it really doesn't matter.

Step 3: Initializing the Lisp / CRAM environment

Fire up your REPL! (If you don't know how, check the Get ready for development part of the installation guide, you will need the roslisp_repl ROS package installed ($ sudo apt-get install ros-DISTRO-roslisp-repl).

We will be working with the cram_semantic_map_costmap package.

First, let's load the ASDF system:

CL-USER> ,
r-l-s RET
cram_semantic_map_costmap RET RET

You should get the “Compilation finished. (No warnings)” message in the Emacs minibuffer.

Now let's change the namespace:

CL-USER> ,
!p RET
sem-map-costmap RET
SEMANTIC-MAP-COSTMAP>

There are three things we need to setup in CRAM to use semantic maps from KnowRob: the fixed frame of our TF tree, the configuration of our location costmap and a new ROS node:

SEMANTIC-MAP-COSTMAP> (setf cram-transforms-stamped:*fixed-frame* "map")
SEMANTIC-MAP-COSTMAP> 
(prolog:def-fact-group costmap-metadata ()
  (<- (location-costmap:costmap-size 12 12))
  (<- (location-costmap:costmap-origin -6 -6))
  (<- (location-costmap:costmap-resolution 0.05))
 
  (<- (location-costmap:costmap-padding 0.2))
  (<- (location-costmap:costmap-manipulation-padding 0.2))
  (<- (location-costmap:costmap-in-reach-distance 0.9))
  (<- (location-costmap:costmap-reach-minimal-distance 0.1)))
SEMANTIC-MAP-COSTMAP> (roslisp-utilities:startup-ros)

(You can fiddle around with the costmap parameters, e.g., make it a bit smaller if your RViz gets luggy when visualizing the costmap.)

Semantic map objects

When you loaded the cram-semantic-map-costmap ASDF package,