Mod semantic map
IMPORTANT: The graphical editor has been moved into the knowrob_gui package that you can check out from github:
The mod_semantic_map package continues to provide the SemanticMapToOWL service.
The editor is designed as a simple graphical tool to facilitate the creation and debugging of semantic maps. It can load and export OWL descriptions of semantic environment maps and allows to create, delete, and modify the objects therein. Its main features are
- Easy creation of object instances
- Pose description using position vector, homography matrix or quaternion
- Simple rotations around the different axes
- Keyboard-shortcuts for the most important commands
- OWL import and export procedures
When starting the program, a file selection dialog will open in which you can select an OWL file to be opened. If you want to start with an empty map, just click on 'cancel'. If you have selected a map, it will be loaded and visualized.
rosmake mod_semantic_map rosrun mod_semantic_map SemanticMapEditor
The left part of the program visualizes the semantic map. Pieces of furniture are drawn in different shades of grey, doors in yellow, rotational hinges as blue cylinders (z-axis pointing along the cylinder towards the block marker), and prismatic joints as green cylinders.
Clicking on an object loads it into the form fields on the right side. There are three synchronized tabs for entering the object information in different ways: First, there is a simple form, allowing to set the position of the object and to rotate it around the axes by 90 degrees. Second, there is a matrix form to enter the 4x4 homography matrix that supports rotation, position, scaling, and shearing. Third, there is a position+quaternion input method to set the position and orientation. Data entered into either tab is being updated in the other ones when switching the tab.
The form fields have the following meaning:
- OBJECT ID: Name of the OWL identifier. Has to be unique and cannot be changed, except by deleting and re-creating an object
- NEW: Clear form fields to create a new object instance. Can also be done implicitly by using a new object ID, which automatically creates a new instance.
- DELETE: remove the currently selected object from the map
- ADD TO MAP: update the visualization with the information from the form fields, e.g. for adding a newly created object to the map (keyboard shortcut: RETURN)
- The grey list of object classes serves for selecting the type of the object. The current selection is shown in the head of the list.
- OBJECT DIMENSIONS: Dimensions of the object in meters.
- OBJECT POSITION: Position of the object center in global coordinates in meters. Analogous for the POSE MATRIX and POSE QUATERNION fields in the other tabs.
- ROT_X, ROT_Y, ROT_Z: Rotate the object around the x,y,z-axis by 90 degrees.
- SELECT PARENT button and PARENT text field: Maps can be hierarchically structured, i.e. the child objects of the map are pieces of furniture like cupboards, which can be further decomposed into doors, handles, etc. This part-of-relation can be set using the following steps:
- First create the parent and the child
- Select the child by clicking on it
- Click on the SELECT PARENT button and click on the parent object
- Alternatively: Enter the identifier of the parent into the PARENT form field
- EXPORT TO OWL: Enter a file name and click on the button to write the current state of the map to an OWL file.
Switching between the text fields can be done using TAB and SHIFT-TAB. For all textfields with numbers, the value can be increased and decreased using PAGE_UP and PAGE_DOWN when the field is selected. This can be used for easily moving object instances along the axes.
Tutorial: Create new semantic map
The following steps describe how to create a map of three cupboards, one of which has a door with a hinge.
- Start the editor, don't select a file but press 'cancel' instead
- Click on the 'new' button, enter a unique name for the first object in the map (without URL/Namespace), e.g. cupboard1
- Select the class 'Cupboard'
- Enter the object dimensions, e.g. [0.5] [0.5] [0.8]. You can switch to the next form field using TAB.
- Enter the object position, e.g.   [0.4]
- Hit ENTER or click on 'Add to map'
- Save the map to an OWL file by typing in the file name and clicking on 'Export to OWL'. It is recommended to regularly save your work while creating the map by just clicking on this button from time to time.
- To create the second and third object, just edit the object ID to 'cupboard2' and 'cupboard3' and change their positions, either by typing [0.5] and [1.0] in the form field X_POS or by hitting ENTER, clicking into the X_POS field and shifting the object with PG_UP
- Create an instance 'door2' of 'Door' with the dimensions [0.5] [0.01] [0.8] at the position [0.5] [0.25] [0.4]
- Click on 'cupboard2' and 'door2' to verify that both are loaded correctly.
- Create a 'HingedJoint' called 'joint2' of arbitrary dimension at the same pose as the door.
- Shift the hinge to the right position at the edge of the door using the PG_UP and PG_DOWN keys
- Click on the JOINT PROPERTIES tab, click on 'select child' and click on the door in the map. Then click on 'select parent' and click on 'cupboard2'.
- You can set the joint limits of the new hinge to whatever value you like
The resulting map should look like this: http://ias.cs.tum.edu/kb/demo-map.owl
- Importing, editing and exporting a file may result in a loss of information that is contained in the original OWL file, but is not correctly parsed into the internal representation and therefore not exported any more.
- Base IRIs are hard-coded in the code (OWLImportExport.java)
- List of object classes is currently hard-coded, but can be easily extended at the top of SemanticMapEditor.java
The SemanticMapToOWL node offers a service for generating an OWL representation of a semantic map from a SemMap message (see msg folder) which is a list of objects with their types, dimensions, poses, and parent objects. This representation is transformed into an OWL representation that is compatible to the files in the ias_semantic_map directory.
A test client is included that creates a map with a single cupboard including door, hinge and handle.
$ roslaunch mod_semantic_map mod_semantic_map.launch $ rosrun mod_semantic_map SemanticMapToOWLTestClient
In general, you run the service like this:
$ rosrun mod_semantic_map SemanticMapToOWL
The service takes a header message and a list of objects as input and returns the generated map in OWL format as a string.
Here is the service format:
$ rossrv show mod_semantic_map/GenerateSemanticMapOWL mod_semantic_map/SemMap map Header header uint32 seq time stamp string frame_id mod_semantic_map/SemMapObject objects int32 id string type float32 width float32 depth float32 height float32 pose int32 partOf --- string owlmap
You should provide a point in time at which the map was perceived, e.g. the current system time, and a namespace that is used for prefixing the map entries, e.g., 'http://example.com/my_map.owl#' by using the fields stamp and frame_id of the header message respectively.
An object in the list should have a unique id, type, width, height, depth, pose (4x4 rotation matrix) and an id of another object of which the object is part of (partOf). If the object is not part of anything please provide a 0.
All geometric information should be provided in meters.
The type of the object can be one from the set of subclasses of the Knowrob concept SpatialThing-Localized. You can retrieve a list of all types by the following command:
$ rosrun mod_semantic_map SemanticMapToOWL list Handle Pitcher TopSide ManipulationPlace Sausage HeatSource FoodVessel GeographicalArea-Intangible DrinkingMug Oven Juice ...
The encoding of type is case-insensitive, i.e. handle, Handle, HANDLE will work.
The service uses the following parameters that set the base IRI of the generated OWL file and the address of the room that is described in the map. The latter is important if the map is to be exchanged via RoboEarth since the search for maps in the DB depends on the address being set. You can adapt the following parameter definitions in the launch file to your values:
<param name="map_address_room_nr" type="string" value="3001" /> <param name="map_address_floor_nr" type="string" value="3" /> <param name="map_address_street_nr" type="string" value="45" /> <param name="map_address_street_name" type="string" value="Karlstrasse" /> <param name="map_address_city_name" type="string" value="Munich" />
- Authors: Moritz Tenorth, Lars Kunze
- License: BSD,LGPL
- API documentation: