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
tutorials:beginner:location_designators_2 [2019/07/09 18:50] – [Location designator generators] gkazhoyatutorials:beginner:location_designators_2 [2022/02/25 23:20] (current) – [Using location designators with the TurtleSim] schimpf
Line 6: Line 6:
 **Next Tutorial:** [[tutorials:beginner:high_level_plans|Writing plans for the TurtleSim]] **Next Tutorial:** [[tutorials:beginner:high_level_plans|Writing plans for the TurtleSim]]
  
 +To run the code in the tutuorial the roscore and the turtlesim need to be started over the terminal. Each in their own tab.
 +<code bash>
 +$ roscore
 +</code>
 +<code bash>
 +$ rosrun turtlesim turtlesim_node
 +</code>
 +
 +And in the REPL the following commands should be executed:
 +<code lisp>
 +CL-USER>(ros-load:load-system "cram_my_beginner_tutorial" :cram-my-beginner-tutorial)
 +...
 +CL-USER>(in-package :tut)
 +</code>
 ===== Location designators: an overview ===== ===== Location designators: an overview =====
  
Line 195: Line 209:
 </code> </code>
  
-Depending on the random number generator we will get some or none of the solutions rejected and, therefore, ''<='' number of valid solutions for our designator ''another-goal''. That means, you might get a different number of solutions than what we got, i.e. 3.+Depending on the random number generator we will get some or none of the solutions rejected and, therefore, ''<='' number of valid solutions for our designator ''another-goal''. That means, you might get a different number of solutions than what we got: we got but you might be 4 or 5 or something else.
  
  
Line 233: Line 247:
          (let ((target-point (reference motion)))          (let ((target-point (reference motion)))
            (roslisp:ros-info (turtle-process-modules)            (roslisp:ros-info (turtle-process-modules)
-                             "Goint to point ~a." target-point)+                             "Going to point ~a." target-point)
            (move-to target-point)))))))            (move-to target-point)))))))
  
Line 271: Line 285:
                                (horizontal-position ?horizontal-position)                                (horizontal-position ?horizontal-position)
                                (vertical-position ?vertical-position)))                                (vertical-position ?vertical-position)))
-               (goal (desig:a motion (type :going-to) (:goal ?area))))+               (goal (desig:a motion (type going-to) (goal ?area))))
           (cram-executive:perform goal))))))           (cram-executive:perform goal))))))
 </code> </code>
  
-In ''goto-location'' we use ''perform'', which means we have to make sure the right process module for our ''going-to'' designator can be found. For that we add a rule to the fact-group ''available-turtle-process-modules'':+In ''goto-location'' we use ''perform'', which means we have to make sure the right process module for our ''going-to'' designator can be found. For that we add a rule to the fact-group ''available-turtle-process-modules'' from the ''selecting-process-modules.lisp'' file. The file should now look like this:
  
 <code lisp> <code lisp>
Line 312: Line 326:
 [(ROSLISP TOP) INFO] 1501153969.641: master URI is 127.0.0.1:11311 [(ROSLISP TOP) INFO] 1501153969.641: master URI is 127.0.0.1:11311
 [(ROSLISP TOP) INFO] 1501153970.649: Node startup complete [(ROSLISP TOP) INFO] 1501153970.649: Node startup complete
-[(TURTLE-PROCESS-MODULES) INFO] 1501153970.689: TurtleSim navigation invoked with motion designator `#<MOTION-DESIGNATOR ((TYPE +[(TURTLE-PROCESS-MODULES) INFO] 1562698457.619: TurtleSim navigation invoked with motion designator `#<MOTION 
-                                                                           GOING-TO) +    (TYPE GOING-TO) 
-                                                                          (GOAL +    (GOAL #<LOCATION 
-                                                                           #<LOCATION-DESIGNATOR +    (HORIZONTAL-POSITION RIGHT) 
-                                                                             ((HORIZONTAL-POSITION +    (VERTICAL-POSITION TOP)>)>'
-                                                                               RIGHT) +[(TURTLE-PROCESS-MODULES) INFO] 1501153970.691: Going to point #<3D-VECTOR (10.131428718566895d0 8.874866485595703d0 0.0d0)>.
-                                                                              (VERTICAL-POSITION +
-                                                                               TOP)+
-                                                                             {1005139363}>)) {1005139703}>'+
-[(TURTLE-PROCESS-MODULES) INFO] 1501153970.691: Goint to point #<3D-VECTOR (10.131428718566895d0 8.874866485595703d0 0.0d0)>.+
 T T
 +</code>
 +
 +If you already had a running node in the REPL, you might get the error shown below but that is absolutely normal: ROS simply notifies you that it is going to shut down the previous node and start a new one.
 +<code lisp>
 +WARNING:
 +   Before starting node, node-status equalled RUNNING instead of :shutdown.  Shutting the previous node invocation down now.
 </code> </code>