# Differences

This shows you the differences between two versions of the page.

tutorials:intermediate:costmaps [2019/03/07 12:51] gkazhoya [Visualization of costmaps] |
tutorials:intermediate:costmaps [2019/04/02 14:03] (current) amar |
||
---|---|---|---|

Line 3: | Line 3: | ||

This tutorial demonstrates the location costmap library of CRAM, including its API, examples of existing costmaps and how to write your own new costmaps. | This tutorial demonstrates the location costmap library of CRAM, including its API, examples of existing costmaps and how to write your own new costmaps. | ||

+ | ===== Introduction ===== | ||

+ | If you recall, the resolution of a location designator is divided into two steps - a generation step and a verification step. The generators yield sequences of solution candidates in the form of lazy lists and verification functions accept or reject solutions. The constraints specified with designators normally restrict the solution space but still leave many potentially valid solutions. The process of resolving location designator properties and generating poses in space is split up into three parts in order to deal with the computational complexity of the six-dimensional space of poses and to make a sampling-based approach feasible. Informally, the generation of a pose can be resolved as follows: | ||

+ | - Generate a two-dimensional grid based on location designator constraints with values greater than zero for all potentially valid solutions. It is a map representing the solution density of a specific cell where greater values represent more solutions for a specific constraint. | ||

+ | - Use the grid as a probability density function to generate random samples. | ||

+ | - Use Heuristics to resolve the orientation and Z coordinate of the generated pose. | ||

+ | - Use the physics-based reasoning system to prove that the solution is valid. | ||

+ | As can be seen, the first three steps generate a solution candidate while the last step verifies it. | ||

+ | |||

+ | Costmaps are density maps of two-dimensional matrices of positive real numbers which allow for representing spacial constraints such as ''on'' or ''in'' but also represent locations from which objects can be reached to a certain extent. Additionally, they can be merged easily and they can be converted to valid probability density functions to be used for sampling. Each entry corresponds to a grid cell in the x-y-plane of the robot's environment. Values of zero indicate that the corresponding grid cell cannot be a solution for the designator to be resolved and values greater than zero indicate potential solution candidates. | ||

+ | |||

+ | For further reading, refer to section 4 of [[https://mediatum.ub.tum.de/doc/1239461/1239461.pdf|Lorenz Mösenlechner Ph.D. Thesis]]. | ||

===== Setup ===== | ===== Setup ===== | ||

Line 92: | Line 103: | ||

(abs (/ (cl-transforms:x point) vector-length)) | (abs (/ (cl-transforms:x point) vector-length)) | ||

0.0d0))))) | 0.0d0))))) | ||

- | </code> | + | </code> To summarize this, we can see that the individual value in the costmap generator is set to the normalized x value of the sampling point if it lies behind the reference point (when x is negative compared to the reference). Else it's set to 0. |

* define order for your costmap function and give it a name: | * define order for your costmap function and give it a name: | ||

Line 98: | Line 109: | ||

<code lisp> | <code lisp> | ||

(defmethod location-costmap:costmap-generator-name->score ((name (eql 'behind-cost-function))) 10) | (defmethod location-costmap:costmap-generator-name->score ((name (eql 'behind-cost-function))) 10) | ||

- | </code> | + | </code> The name of our costmap function would be ''behind-cost-function'' and it's order is 10 |

* define the prolog rule for generating costmaps: | * define the prolog rule for generating costmaps: | ||

Line 114: | Line 125: | ||

(make-behind-cost-function ?ref-x ?ref-y) | (make-behind-cost-function ?ref-x ?ref-y) | ||

?costmap))) | ?costmap))) | ||

- | </code> | + | </code> In short, the reference x and y is obtained from the pose we have to calculate the ''behind'' relation to. These are then passed on to our previously defined costmap generator, which in turn will generate the costmap we require. |

* resolve a designator with your new awesome costmap: | * resolve a designator with your new awesome costmap: |