User Tools

Site Tools


software:cram:development_experiences:new_goals

How to register and achieve a new goal

A plan for a new goal

Let's assume we wanna write a plan to achieve a new goal, e.g. to flip a pancake. Best practice is to put this plan into one of the source-files of a plan library, e.g. cram_plan_library:

(def-goal (achieve (flip-pancake ...))
  (with-designators ((action-desig 
                       (action `((to flip))))
                     ...)
    ...
    (perform action)))

If you want other packages to also use this plan, export the goal-symbol in the package.lisp of the your plan library. Make sure to also export all designator properties used in your plan:

(desig-props:def-desig-package cram-plan-library
 ...
 (:export #:...
          #:flip-pancake
          ...)
 (:desig-properties #:to #:flip ...))

Catch #1: If you one of your manipulation process modules, e.g. the pr2_manipulation_process_module, uses the same designator properties it also has to export the same properties. I (Georg) do not understand why but Jan says this necessary for them to talk about the same symbol.

Catch #2: You also need to export the goal-symbol, i.e. flip-pancake, from the package cram_plan_knowledge! The reason for this was not clear at the time of writing… Thus, yuo also need to add #:flip-pancake to package.lisp of cram_plan_library. Otherwise you will get a warning like this when trying to achieve flip-pancake:

WARNING:
   Trying to prove goal (FLIP-PANCAKE
                         #<OBJECT-DESIGNATOR ((TYPE PANCAKE))
                           {100926AF61}>) with undefined functor CRAM-PLAN-LIBRARY:FLIP-PANCAKE.

How to use/achieve the new plan

You can now try to achieve your new goal like this:

(top-level
  (cpm:with-process-modules-running
      (pr2-manipulation-process-module)
    (achieve `(flip-pancake))))

You need to make sure that cram_environment_representation is loaded (either in your package that uses cram_plan_library or in your REPL). Otherwise (holds …) will not be known.

software/cram/development_experiences/new_goals.txt · Last modified: 2016/05/19 09:19 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki