Mercurial > cortex
comparison org/joint.org @ 348:5405f369f4a0
added summary of each sense for the joint.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 23 Jul 2012 03:51:13 -0500 |
parents | ef958c44563d |
children | d2806d5c5f74 |
comparison
equal
deleted
inserted
replaced
347:ef958c44563d | 348:5405f369f4a0 |
---|---|
1 | 1 |
2 | 2 |
3 * A self learning joint | 3 * A joint |
4 | |
5 The point of this joint is that it uses exploratory motor movements to | |
6 learn how to move to any particular position. | |
7 | |
8 visual-information -- list of functions which must each be called with the | |
9 world the argument, each of which returns [topology data]. Each element | |
10 of data is a number between 0 and 255 representing the intensity of | |
11 the light recieved at that sensor. | |
12 | |
13 proprioception -- list of nullary functions, one for each joint, which | |
14 return [heding pitch roll]. | |
15 | |
16 touch -- list of functions which must each be called with a Node | |
17 (normally the root node of the simulation) the argument, each of which | |
18 returns [topology data]. Each element of data is a posive float | |
19 between 0.0 and the max length of the "hairs" of which the touch sense | |
20 is composed. | |
21 | |
22 movement -- list of functions, one for each muscle, which must be | |
23 called with an integer between 0 and the total number of muscle fibers | |
24 in the muscle. Each function returns a float which is (current-force/ | |
25 total-possible-force). | |
26 | |
4 | 27 |
5 #+name: load-creature | 28 #+name: load-creature |
6 #+begin_src clojure | 29 #+begin_src clojure |
7 (in-ns 'cortex.joint) | 30 (in-ns 'cortex.joint) |
8 | 31 |
10 | 33 |
11 (defn load-creature [] | 34 (defn load-creature [] |
12 (load-blender-model joint)) | 35 (load-blender-model joint)) |
13 | 36 |
14 | 37 |
38 | |
39 | |
40 | |
15 (defn test-creature [] | 41 (defn test-creature [] |
16 | |
17 (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false) | 42 (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false) |
18 creature (doto (load-creature) (body!)) | 43 creature (doto (load-creature) (body!)) |
19 | 44 |
20 ;;;;;;;;;;;; Sensors/Effectors ;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 45 ;;;;;;;;;;;; Sensors/Effectors ;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
21 touch (touch! creature) | 46 touch (touch! creature) |
22 touch-display (view-touch) | 47 touch-display (view-touch) |
23 | 48 |
24 ;;vision (vision! creature) | 49 vision (vision! creature) |
25 ;;vision-display (view-vision) | 50 vision-display (view-vision) |
26 | 51 |
27 ;;hearing (hearing! creature) | 52 ;;hearing (hearing! creature) |
28 ;;hearing-display (view-hearing) | 53 ;;hearing-display (view-hearing) |
29 | 54 |
30 prop (proprioception! creature) | 55 prop (proprioception! creature) |
35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 60 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
36 | 61 |
37 fix-display (gen-fix-display) | 62 fix-display (gen-fix-display) |
38 | 63 |
39 floor (box 10 2 10 :position (Vector3f. 0 -9 0) | 64 floor (box 10 2 10 :position (Vector3f. 0 -9 0) |
40 :color ColorRGBA/Gray :mass 0) | 65 :color ColorRGBA/Gray :mass 0)] |
41 | |
42 timer (RatchetTimer. 60) | |
43 ] | |
44 | |
45 | |
46 (world | 66 (world |
47 (nodify [floor me creature]) | 67 (nodify [floor me creature]) |
48 standard-debug-controls | 68 standard-debug-controls |
49 (fn [world] | 69 (fn [world] |
50 (.setTimer world timer) | 70 (let [timer (RatchetTimer. 60)] |
51 ) | 71 (.setTimer world timer) |
72 (display-dilated-time world timer))) | |
52 (fn [world tpf] | 73 (fn [world tpf] |
74 (.setLocalTranslation me (.getLocation (.getCamera world))) | |
53 (fix-display world))))) | 75 (fix-display world))))) |
54 | 76 |
55 | 77 |
56 | 78 |
57 | 79 |