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:assigning_actions_2 [2017/07/27 08:12] – [Automatically choosing a process module for a motion] Add prevoius and next tutorial cpotutorials:beginner:assigning_actions_2 [2019/07/29 10:36] – Added turtlesim-srv to the dependencies amar
Line 4: Line 4:
  
  
-**Previous Tutorial:** [[tutorials:beginner:process_modules|Creating process modules]]\\ +**Previous Tutorial:** [[tutorials:beginner:process_modules_2|Creating process modules]]\\ 
-**Next Tutorial:** [[tutorials:beginner:location_designators|Using location designators with the turtlesim]]\\+**Next Tutorial:** [[tutorials:beginner:location_designators_2|Using location designators with the TurtleSim]]\\
  
 ===== Setting up fact groups to select a process module ===== ===== Setting up fact groups to select a process module =====
  
-First let's create a new file ''selecting-process-modules.lisp'' and add it to our ''*.asd'' file, which should now look like this:+First let's create a new file ''selecting-process-modules.lisp'' and add it to our ''*.asd'' file. We also need to add ''cram-executive'' as a dependency to our system. It should now look like this:
  
 <code lisp> <code lisp>
-(defsystem cram-beginner-tutorial+(defsystem cram-my-beginner-tutorial
   :depends-on (cram-language roslisp turtlesim-msg geometry_msgs-msg cl-transforms   :depends-on (cram-language roslisp turtlesim-msg geometry_msgs-msg cl-transforms
-                             cram-designators cram-prolog+                             cram-designators cram-prolog turtlesim-srv
                              cram-process-modules cram-language-designator-support                              cram-process-modules cram-language-designator-support
                              cram-executive)                              cram-executive)
Line 24: Line 24:
              (:file "simple-plans" :depends-on ("package" "control-turtlesim"))              (:file "simple-plans" :depends-on ("package" "control-turtlesim"))
              (:file "motion-designators" :depends-on ("package"))              (:file "motion-designators" :depends-on ("package"))
-             (:file "turtle-action-client" :depends-on ("package")) 
              (:file "process-modules" :depends-on ("package"              (:file "process-modules" :depends-on ("package"
                                                    "control-turtlesim"                                                    "control-turtlesim"
                                                    "simple-plans"                                                    "simple-plans"
-                                                   "motion-designators+                                                   "motion-designators"))
-                                                   "turtle-action-client"))+
              (:file "selecting-process-modules" :depends-on ("package"              (:file "selecting-process-modules" :depends-on ("package"
                                                              "motion-designators"                                                              "motion-designators"
-                                                             "location-designators" 
                                                              "process-modules"))))))                                                              "process-modules"))))))
 </code> </code>
Line 76: Line 73:
  
 <code lisp> <code lisp>
-TUT> (defparameter fast-circle (desig:a motion (type driving) (speed 10) (angle 7))) +TUT> (defparameter *fast-circle(desig:a motion (type driving) (speed 10) (angle 7))) 
-FAST-CIRCLE +*FAST-CIRCLE* 
-TUT> (defparameter goal (desig:a motion (type moving) (goal (1 9 0)))) +TUT> (defparameter *goal(desig:a motion (type moving) (goal (1 9 0)))) 
-GOAL +*GOAL* 
-TUT> (defparameter pen-off (desig:a motion (type setting-pen) (off 1))) +TUT> (defparameter *pen-off(desig:a motion (type setting-pen) (off 1))) 
-PEN-OFF+*PEN-OFF*
 </code> </code>
  
Line 87: Line 84:
  
 <code lisp> <code lisp>
-TUT> (perform-some-motion fast-circle)+TUT> (perform-some-motion *fast-circle*)
 [(TURTLE-PROCESS-MODULES) INFO] 1501142699.638: TurtleSim navigation invoked with motion designator `#<MOTION-DESIGNATOR ((TYPE [(TURTLE-PROCESS-MODULES) INFO] 1501142699.638: TurtleSim navigation invoked with motion designator `#<MOTION-DESIGNATOR ((TYPE
                                                                            DRIVING)                                                                            DRIVING)
Line 102: Line 99:
  
 <code lisp> <code lisp>
-(perform-some-motion goal)+(perform-some-motion *goal*)
 [(TURTLE-PROCESS-MODULES) INFO] 1501142702.867: TurtleSim navigation invoked with motion designator `#<MOTION-DESIGNATOR ((TYPE [(TURTLE-PROCESS-MODULES) INFO] 1501142702.867: TurtleSim navigation invoked with motion designator `#<MOTION-DESIGNATOR ((TYPE
                                                                            MOVING)                                                                            MOVING)
Line 110: Line 107:
 T T
 </code> </code>
 +
 +You can also perform ''*pen-off*'' and then one of the others to see that the turtle doesn't leave a trace anymore.
 +
 +<code lisp>
 + (perform-some-motion *pen-off*)
 +[(TURTLE-PROCESS-MODULES) INFO] 1504786623.566: TurtleSim pen control invoked with motion designator `#<MOTION-DESIGNATOR ((TYPE
 +                                                                            SETTING-PEN)
 +                                                                           (OFF
 +                                                                            1)) {1002BB26A3}>'.
 +[TURTLESIM-SRV:SETPEN-RESPONSE]
 +TUT> (perform-some-motion *fast-circle*)
 +[(TURTLE-PROCESS-MODULES) INFO] 1504786630.845: TurtleSim navigation invoked with motion designator `#<MOTION-DESIGNATOR ((TYPE
 +                                                                           DRIVING)
 +                                                                          (SPEED
 +                                                                           10)
 +                                                                          (ANGLE
 +                                                                           7)) {1002BB2CD3}>'.
 +1
 +</code>
 +
 +You can turn the pen back on with this:
 +
 +<code lisp>
 +(perform-some-motion (desig:a motion (type setting-pen) (off 0)))
 +[(TURTLE-PROCESS-MODULES) INFO] 1504786654.744: TurtleSim pen control invoked with motion designator `#<MOTION-DESIGNATOR ((TYPE
 +                                                                            SETTING-PEN)
 +                                                                           (OFF
 +                                                                            0)) {1002D6D763}>'.
 +[TURTLESIM-SRV:SETPEN-RESPONSE]
 +</code>
 +
 +== Next ==
 +
 +Let's have a look at location designators and other ways to move the turtle, as well as have some more practice with designator resolution and process modules … 
 +
 +[[tutorials:beginner:location_designators_2|Using location designators with the TurtleSim]]