Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:beginner:location_designators_2 [2017/07/27 11:23] – Expand a process module instead of creating a new one. cpo | tutorials:beginner:location_designators_2 [2022/02/25 23:20] (current) – [Using location designators with the TurtleSim] schimpf | ||
---|---|---|---|
Line 3: | Line 3: | ||
**Description: | **Description: | ||
- | **Previous Tutorial:** [[tutorials: | + | **Previous Tutorial:** [[tutorials: |
+ | **Next Tutorial:** [[tutorials: | ||
+ | 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 bash> | ||
+ | $ rosrun turtlesim turtlesim_node | ||
+ | </ | ||
+ | |||
+ | And in the REPL the following commands should be executed: | ||
+ | <code lisp> | ||
+ | CL-USER> | ||
+ | ... | ||
+ | CL-USER> | ||
+ | </ | ||
===== Location designators: | ===== Location designators: | ||
Line 31: | Line 46: | ||
===== Location designator generators ===== | ===== Location designator generators ===== | ||
- | Let's create a new file called '' | + | Let's create a new file called '' |
<code lisp> | <code lisp> | ||
- | (defsystem cram-beginner-tutorial | + | (defsystem cram-my-beginner-tutorial |
:depends-on (roslisp cram-language turtlesim-msg turtlesim-srv cl-transforms geometry_msgs-msg cram-designators cram-prolog | :depends-on (roslisp cram-language turtlesim-msg turtlesim-srv cl-transforms geometry_msgs-msg cram-designators cram-prolog | ||
| | ||
Line 61: | Line 76: | ||
| | ||
TUT> goal-desig | TUT> goal-desig | ||
- | #< | + | #<A LOCATION |
- | | + | |
+ | (HORIZONTAL-POSITION LEFT)> | ||
</ | </ | ||
Line 193: | Line 209: | ||
</ | </ | ||
- | Depending on the random number generator we will get some or none of the solutions rejected and, therefore, ''< | + | Depending on the random number generator we will get some or none of the solutions rejected and, therefore, ''< |
Line 201: | Line 218: | ||
<code lisp> | <code lisp> | ||
- | (def-fact-group goal-motions (motion-desig) | + | (def-fact-group goal-motions (motion-grounding) |
- | (<- (motion-desig ?desig (go-to ?point)) | + | (<- (motion-grounding |
(desig-prop ?desig (:type :going-to)) | (desig-prop ?desig (:type :going-to)) | ||
(desig-prop ?desig (:goal ?point)))) | (desig-prop ?desig (:goal ?point)))) | ||
Line 230: | Line 247: | ||
(let ((target-point (reference motion))) | (let ((target-point (reference motion))) | ||
| | ||
- | " | + | " |
| | ||
Line 268: | Line 285: | ||
| | ||
| | ||
- | (goal (desig:a motion (type :going-to) (:goal ?area)))) | + | (goal (desig:a motion (type going-to) (goal ?area)))) |
(cram-executive: | (cram-executive: | ||
</ | </ | ||
- | And let's give it a go. Reload the tutorial in '' | + | In '' |
+ | |||
+ | <code lisp> | ||
+ | (in-package :tut) | ||
+ | |||
+ | (def-fact-group available-turtle-process-modules (available-process-module | ||
+ | matching-process-module) | ||
+ | (<- (available-process-module turtlesim-navigation)) | ||
+ | (<- (available-process-module turtlesim-pen-control)) | ||
+ | |||
+ | (<- (matching-process-module ?desig turtlesim-navigation) | ||
+ | (desig-prop ?desig (:type : | ||
+ | (<- (matching-process-module ?desig turtlesim-navigation) | ||
+ | (desig-prop ?desig (:type : | ||
+ | (<- (matching-process-module ?desig turtlesim-navigation) | ||
+ | (desig-prop ?desig (:type : | ||
+ | (<- (matching-process-module ?desig turtlesim-pen-control) | ||
+ | (desig-prop ?desig (:type : | ||
+ | |||
+ | (defun perform-some-motion (motion-desig) | ||
+ | (top-level | ||
+ | (with-process-modules-running (turtlesim-navigation turtlesim-pen-control) | ||
+ | (cram-executive: | ||
+ | </ | ||
+ | |||
+ | It's the same as the other ones. If the type of ''? | ||
+ | |||
+ | Now let's give it a go. Reload the tutorial in '' | ||
<code lisp> | <code lisp> | ||
Line 282: | Line 326: | ||
[(ROSLISP TOP) INFO] 1501153969.641: | [(ROSLISP TOP) INFO] 1501153969.641: | ||
[(ROSLISP TOP) INFO] 1501153970.649: | [(ROSLISP TOP) INFO] 1501153970.649: | ||
- | [(TURTLE-PROCESS-MODULES) INFO] 1501153970.689: TurtleSim navigation invoked with motion designator `#< | + | [(TURTLE-PROCESS-MODULES) INFO] 1562698457.619: TurtleSim navigation invoked with motion designator `#<A MOTION |
- | GOING-TO) | + | |
- | (GOAL | + | (GOAL #<A LOCATION |
- | #< | + | (HORIZONTAL-POSITION RIGHT) |
- | ((HORIZONTAL-POSITION | + | (VERTICAL-POSITION TOP)> |
- | RIGHT) | + | [(TURTLE-PROCESS-MODULES) INFO] 1501153970.691: |
- | (VERTICAL-POSITION | + | |
- | TOP)) | + | |
- | | + | |
- | [(TURTLE-PROCESS-MODULES) INFO] 1501153970.691: | + | |
T | T | ||
+ | </ | ||
+ | |||
+ | 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: | ||
+ | | ||
</ | </ | ||