Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tutorials:beginner:assigning_actions_2 [2017/07/27 08:07] – created cpo | tutorials:beginner:assigning_actions_2 [2022/02/25 23:19] (current) – [Automatically choosing a process module for a motion] schimpf | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Automatically choosing a process module for an action | + | ====== Automatically choosing a process module for a motion |
**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> | ||
+ | ... | ||
+ | TUT> | ||
+ | ... | ||
+ | TUT> | ||
+ | </ | ||
===== 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 '' | + | First let's create a new file '' |
<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 | ||
- | | + | |
| | ||
| | ||
Line 22: | Line 44: | ||
| | ||
| | ||
- | | ||
| | ||
" | " | ||
" | " | ||
- | " | + | " |
- | " | + | |
| | ||
" | " | ||
- | " | ||
" | " | ||
</ | </ | ||
Line 67: | Line 86: | ||
This function is mostly similar to previous ones we used to call process modules; the difference is that rather than calling '' | This function is mostly similar to previous ones we used to call process modules; the difference is that rather than calling '' | ||
- | ===== Running | + | ===== Running |
Let's load our code in '' | Let's load our code in '' | ||
Line 74: | Line 93: | ||
<code lisp> | <code lisp> | ||
- | TUT> (defparameter fast-circle (desig:a motion (type driving) (speed 10) (angle 7))) | + | TUT> (defparameter |
- | FAST-CIRCLE | + | *FAST-CIRCLE* |
- | TUT> (defparameter goal (desig:a motion (type moving) (goal (1 9 0)))) | + | TUT> (defparameter |
- | GOAL | + | *GOAL* |
- | TUT> (defparameter pen-off (desig:a motion (type setting-pen) (off 1))) | + | TUT> (defparameter |
- | PEN-OFF | + | *PEN-OFF* |
</ | </ | ||
Line 85: | Line 104: | ||
<code lisp> | <code lisp> | ||
- | TUT> (perform-some-motion fast-circle) | + | TUT> (perform-some-motion |
[(TURTLE-PROCESS-MODULES) INFO] 1501142699.638: | [(TURTLE-PROCESS-MODULES) INFO] 1501142699.638: | ||
| | ||
Line 100: | Line 119: | ||
<code lisp> | <code lisp> | ||
- | (perform-some-motion goal) | + | (perform-some-motion |
[(TURTLE-PROCESS-MODULES) INFO] 1501142702.867: | [(TURTLE-PROCESS-MODULES) INFO] 1501142702.867: | ||
| | ||
Line 108: | Line 127: | ||
T | T | ||
</ | </ | ||
+ | |||
+ | You can also perform '' | ||
+ | |||
+ | <code lisp> | ||
+ | | ||
+ | [(TURTLE-PROCESS-MODULES) INFO] 1504786623.566: | ||
+ | SETTING-PEN) | ||
+ | (OFF | ||
+ | 1)) {1002BB26A3}>' | ||
+ | [TURTLESIM-SRV: | ||
+ | TUT> (perform-some-motion *fast-circle*) | ||
+ | [(TURTLE-PROCESS-MODULES) INFO] 1504786630.845: | ||
+ | | ||
+ | (SPEED | ||
+ | 10) | ||
+ | (ANGLE | ||
+ | 7)) {1002BB2CD3}>' | ||
+ | 1 | ||
+ | </ | ||
+ | |||
+ | 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: | ||
+ | SETTING-PEN) | ||
+ | (OFF | ||
+ | 0)) {1002D6D763}>' | ||
+ | [TURTLESIM-SRV: | ||
+ | </ | ||
+ | |||
+ | == 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: |