Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
tutorials:beginner:location_designators [2016/01/25 21:44] gkazhoyatutorials:beginner:location_designators [2016/03/04 14:11] gkazhoya
Line 56: Line 56:
 </code> </code>
  
-Now we'll want some code to generate a location based on a symbolic description found in a designator. There are two interfaces for resolving location designators: one analogous to action designators' ''(action-desig ?desig ?solution)'' Prolog predicate, for locations it's ''(desig-solution ?desig ?solution)'' (predicate names could've been more similar, but, oh well). However, with Prolog rules all solutions have more or less the same priority, and if one constraint can be resolved to multiple solutions there is no way to prioritize one over the other. One use case of priorities is to always just in case check robot's current position when a pose for the robot base is being resolved: if robot's current pose is already sufficient to execute some task (location validator says '':accept'') this mechanism can save some time on re-positioning. In this case robot's current pose will always have higher priority over the rest of location generators. In this tutorial we will implement the same functionality using both interfaces and compare the pros and cons of both.+Now we'll want some code to generate a location based on a symbolic description found in a designator. There are two interfaces for resolving location designators: one analogous to action designators' ''(action-desig ?desig ?solution)'' Prolog predicate, for locations it's ''(desig-solution ?desig ?solution)'' (predicate names could've been more similar, but, oh well), the mechanism is exactly the same as for action designators. However, with Prolog rules all solutions have more or less the same priority, and if one constraint can be resolved to multiple solutions there is no way to prioritize one over the other. One use case of priorities is to always just in case check robot's current position when a pose for the robot base is being resolved: if robot's current pose is already sufficient to execute some task (location validator says '':accept'') this mechanism can save some time on re-positioning. In this case robot's current pose will always have higher priority over the rest of location generators. In this tutorial we will implement a custom generator function that can be prioritized. In fact, the solutions coming from Prolog predicate ''(desig-solution ?location-desig ?solution)'' are also implemented as a custom generator with priority 10. We will discuss priorities in more detail below.
  
 We would like to specify locations for the turtle to go using spatial relations, e.g.: We would like to specify locations for the turtle to go using spatial relations, e.g.:
 <code lisp> <code lisp>
 TUT> (defparameter goal-desig TUT> (defparameter goal-desig
-       (make-designator :location '((:vertical-position :bottom) (:horizontal-position :left))))+       (make-designator 'location '((:vertical-position :bottom) (:horizontal-position :left))))
 TUT> goal-desig TUT> goal-desig
 #<LOCATION-DESIGNATOR ((:VERTICAL-POSITION :BOTTOM) #<LOCATION-DESIGNATOR ((:VERTICAL-POSITION :BOTTOM)
Line 184: Line 184:
 <code lisp> <code lisp>
 TUT> (defparameter another-goal TUT> (defparameter another-goal
-       (make-designator :location '((:vertical-position :bottom) (:horizontal-position :left))))+       (make-designator 'location '((:vertical-position :bottom) (:horizontal-position :left))))
 ANOTHER-GOAL ANOTHER-GOAL
 TUT> (loop for desig = another-goal then (next-solution desig) TUT> (loop for desig = another-goal then (next-solution desig)
Line 254: Line 254:
         (process-module-alias :navigation 'actionlib-navigation)         (process-module-alias :navigation 'actionlib-navigation)
         (with-designators         (with-designators
-            ((trajectory :action `((:type :shape) (:shape :hexagon) (:radius ,radius))))+            ((trajectory action `((:type :shape) (:shape :hexagon) (:radius ,radius))))
           (pm-execute :navigation trajectory))))))           (pm-execute :navigation trajectory))))))
  
Line 265: Line 265:
         (process-module-alias :navigation 'simple-navigation)         (process-module-alias :navigation 'simple-navigation)
         (with-designators         (with-designators
-            ((area :location `((:horizontal-position ,horizontal-position)+            ((area location `((:horizontal-position ,horizontal-position)
                                (:vertical-position ,vertical-position)))                                (:vertical-position ,vertical-position)))
-             (goal :action `((:type :goal) (:goal ,area))))+             (goal action `((:type :goal) (:goal ,area))))
           (pm-execute :navigation goal))))))           (pm-execute :navigation goal))))))
 </code> </code>