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
Next revisionBoth sides next revision
tutorials:beginner:failure_handling [2019/07/16 11:33] cpotutorials:beginner:failure_handling [2022/03/15 13:36] – [Defining and signaling a failure condition] schimpf
Line 3: Line 3:
 **Description:** In this tutorial you will learn how to implement failure handling for your plans. **Description:** In this tutorial you will learn how to implement failure handling for your plans.
  
-**Previous Tutorial:** [[tutorials:beginner:high_level_plans|Writing plans for the TurtleSim]] +**Previous Tutorial:** [[tutorials:beginner:high_level_plans|Writing plans for the TurtleSim]]\\
 **Next Tutorial:** [[tutorials:beginner:testing|Writing tests]] **Next Tutorial:** [[tutorials:beginner:testing|Writing tests]]
  
Line 108: Line 107:
 (defparameter *max-bound* 10.5) (defparameter *max-bound* 10.5)
  
-(defun navigate (?v)+(defun navigate (&key ((:target ?target)) 
 +                 &allow-other-keys) 
 +  (declare (type (or list null) ?target))
   (flet ((out-of-bounds (pose)   (flet ((out-of-bounds (pose)
            (with-fields (x y)            (with-fields (x y)
Line 117: Line 118:
       (whenever ((fl-funcall #'out-of-bounds *turtle-pose*))       (whenever ((fl-funcall #'out-of-bounds *turtle-pose*))
         (error 'out-of-bounds-error))         (error 'out-of-bounds-error))
-      (exe:perform (a motion (type moving) (goal ?v))))))+      (exe:perform (a motion (type moving) (goal ?target))))))
 </code> </code>