Create and load a semantic map


This page describes the 'catkinized' version of KnowRob that uses the catkin buildsystem and the pure Java-based rosjava. The documentation for the older version, which was based on the rosbuild buildsystem and rosjava_jni, can be found here.


Semantic maps are descriptions of an environment in terms of localized object instances and are stored in OWL files. Much of the environment- and object-related functionality in KnowRob depends of having a valid semantic map, so you may want to create one for your robot's environment.

Create your semantic map

There are different ways how to create a semantic map in OWL:

Semantic Map Editor

The Semantic Map Editor is a graphical editor for semantic maps. It can be used to create object instances and to set their positions. The current version is rather specific for indoor environments though and, for example, offers only a limited set of object types to be added to the map. You can easily adapt the list of classes in the source code, but this cannot conveniently be configured at the moment.

SemanticMapToOWL

If you already have a map datastructure and would like to create a semantic map from your program, the SemanticMapToOWL ROS service is probably the easiest solution. It accepts a SemanticMap message and returns the OWL data as a string.

Robot perception system

If you have integrated a perception system with KnowRob, a kind of semantic map is automatically created by the objects the robot perceives. You can save the in-memory map to an OWL file using the methods in the owl_export module.

Manual creation of the OWL file

In some cases, it may actually be the fastest to create the map manually in a good text editor in which you can copy and paste the object instances and their pose matrices. Especially if you would like to set many semantic object properties beyond their poses, this may be a good option. If you plan to do this, you should have well understood how object poses are represented in KnowRob.

Load the map into KnowRob

To make the map available for querying and inference in KnowRob, you just need to parse the OWL file. You can either do this manually after having started the KnowRob shell using the owl_parse predicate given below, or you can put that command into the init.pl of a package you have created.

 $ rosrun rosprolog rosprolog ias_knowledge_base
 ?- owl_parse('path/to/file.owl', false, false, true).