Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:intermediate:semantic_environment_map [2016/01/14 17:03] – gkazhoya | tutorials:intermediate:semantic_environment_map [2016/06/14 13:15] (current) – [Setting up] gkazhoya | ||
---|---|---|---|
Line 14: | Line 14: | ||
===== Setting up ===== | ===== Setting up ===== | ||
- | **Step 1:** start publishing the semantic environment map through JSON Prolog and TF etc.. | + | === Step 1: start publishing the semantic environment map through JSON Prolog and TF etc. === |
In a fresh terminal: | In a fresh terminal: | ||
Line 22: | Line 22: | ||
</ | </ | ||
- | **Step 2:** visualization setup. | + | === Step 2: visualization setup === |
In a separate terminal: | In a separate terminal: | ||
Line 32: | Line 32: | ||
The recommended RViz setup is shown below: | The recommended RViz setup is shown below: | ||
{{ : | {{ : | ||
+ | |||
+ | Pay attention especially at the '' | ||
+ | |||
+ | Depending on the version of your map you might also have an additional table there but it really doesn' | ||
+ | |||
+ | === Step 3: Initializing the Lisp / CRAM environment === | ||
+ | |||
+ | Fire up your REPL! (If you don't know how, check the [[http:// | ||
+ | |||
+ | We will be working with the '' | ||
+ | |||
+ | First, let's load the ASDF system: | ||
<code lisp> | <code lisp> | ||
- | list code | + | CL-USER> , |
+ | r-l-s RET | ||
+ | cram_semantic_map_costmap RET RET | ||
</ | </ | ||
+ | You should get the " | ||
+ | |||
+ | Now let's change the namespace: | ||
+ | |||
+ | <code lisp> | ||
+ | CL-USER> , | ||
+ | !p RET | ||
+ | sem-map-costmap RET | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | </ | ||
+ | |||
+ | To use semantic maps from KnowRob in CRAM we first need to set our '' | ||
+ | |||
+ | <code lisp> | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | (prolog: | ||
+ | (<- (location-costmap: | ||
+ | (<- (location-costmap: | ||
+ | (<- (location-costmap: | ||
+ | |||
+ | (<- (location-costmap: | ||
+ | (<- (location-costmap: | ||
+ | (<- (location-costmap: | ||
+ | (<- (location-costmap: | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | </ | ||
+ | |||
+ | ===== Semantic map objects ===== | ||
+ | |||
+ | Let's ask KnowRob for the semantic map (it might take a while): | ||
+ | |||
+ | <code lisp> | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | #< | ||
+ | </ | ||
+ | |||
+ | If you right-click on the result object and click '' | ||
+ | |||
+ | There is a hash table stored in the '' | ||
+ | |||
+ | Here are a bunch of '' | ||
+ | < | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | </ | ||
+ | |||
+ | If you inspect a '' | ||
+ | {{ : | ||
+ | |||
+ | Most of the classes and utility functions are defined in the '' | ||
+ | |||
+ | <code lisp> | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | #< | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | #< | ||
+ | #< | ||
+ | #< | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | #< | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Designators ===== | ||
+ | |||
+ | Now let's create a symbolic object description to correspond to a part of the semantic map. | ||
+ | We cannot resolve object designators using the '' | ||
+ | |||
+ | <code lisp> | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | (cram-semantic-map-designators: | ||
+ | | ||
+ | (#< | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | (cram-semantic-map-designators: | ||
+ | | ||
+ | (#< | ||
+ | </ | ||
+ | |||
+ | We can also ask for a location of an semantic map part: | ||
+ | <code lisp> | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | , | ||
+ | #< | ||
+ | #< | ||
+ | {100E276F63}> | ||
+ | | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | #< | ||
+ | | ||
+ | #< | ||
+ | #< | ||
+ | </ | ||
+ | |||
+ | A location description can be ambiguous, e.g., if we would like to have a location of an object of a certain semantic map part type: | ||
+ | <code lisp> | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | (let* ((object-of-type-cupboard (make-designator :object ' | ||
+ | | ||
+ | (format t "one solution: ~a~%" (reference location-of-cupboard)) | ||
+ | (format t " | ||
+ | one solution: #< | ||
+ | | ||
+ | #< | ||
+ | #< | ||
+ | another solution: #< | ||
+ | | ||
+ | #< | ||
+ | #< | ||
+ | </ | ||
+ | There are multiple objects of type cupboard, so we get multiple solutions. | ||
+ | |||
+ | In the example semantic map '': | ||
+ | |||
+ | Now, let's use the location costmap mechanism to ground locations on or in objects: | ||
+ | <code lisp> | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | #< | ||
+ | | ||
+ | #< | ||
+ | #< | ||
+ | </ | ||
+ | {{ : | ||
+ | The big red dot is the location sampled for this designator. | ||
+ | |||
+ | If we want a location on a specific object, not on all objects of a certain type, we can specify that using the '': | ||
+ | <code lisp> | ||
+ | SEMANTIC-MAP-COSTMAP> | ||
+ | (:name " | ||
+ | #< | ||
+ | | ||
+ | #< | ||
+ | #< | ||
+ | </ | ||
+ | {{ : | ||
+ | The marker array in RViz show a uniform distribution of all possible locations that satisfy the symbolic constraint in the designator. |