rlm@346
|
1
|
rlm@346
|
2
|
rlm@346
|
3 * A self learning joint
|
rlm@343
|
4
|
rlm@347
|
5 #+name: load-creature
|
rlm@347
|
6 #+begin_src clojure
|
rlm@347
|
7 (in-ns 'cortex.joint)
|
rlm@343
|
8
|
rlm@347
|
9 (def joint "Models/joint/joint.blend")
|
rlm@347
|
10
|
rlm@347
|
11 (defn load-creature []
|
rlm@347
|
12 (load-blender-model joint))
|
rlm@347
|
13
|
rlm@347
|
14
|
rlm@347
|
15 (defn test-creature []
|
rlm@347
|
16
|
rlm@347
|
17 (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
|
rlm@347
|
18 creature (doto (load-creature) (body!))
|
rlm@347
|
19
|
rlm@347
|
20 ;;;;;;;;;;;; Sensors/Effectors ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
rlm@347
|
21 touch (touch! creature)
|
rlm@347
|
22 touch-display (view-touch)
|
rlm@347
|
23
|
rlm@347
|
24 ;;vision (vision! creature)
|
rlm@347
|
25 ;;vision-display (view-vision)
|
rlm@347
|
26
|
rlm@347
|
27 ;;hearing (hearing! creature)
|
rlm@347
|
28 ;;hearing-display (view-hearing)
|
rlm@347
|
29
|
rlm@347
|
30 prop (proprioception! creature)
|
rlm@347
|
31 prop-display (view-proprioception)
|
rlm@347
|
32
|
rlm@347
|
33 muscles (movement! creature)
|
rlm@347
|
34 muscle-display (view-movement)
|
rlm@347
|
35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
rlm@347
|
36
|
rlm@347
|
37 fix-display (gen-fix-display)
|
rlm@347
|
38
|
rlm@347
|
39 floor (box 10 2 10 :position (Vector3f. 0 -9 0)
|
rlm@347
|
40 :color ColorRGBA/Gray :mass 0)
|
rlm@347
|
41
|
rlm@347
|
42 timer (RatchetTimer. 60)
|
rlm@347
|
43 ]
|
rlm@347
|
44
|
rlm@347
|
45
|
rlm@347
|
46 (world
|
rlm@347
|
47 (nodify [floor me creature])
|
rlm@347
|
48 standard-debug-controls
|
rlm@347
|
49 (fn [world]
|
rlm@347
|
50 (.setTimer world timer)
|
rlm@347
|
51 )
|
rlm@347
|
52 (fn [world tpf]
|
rlm@347
|
53 (fix-display world)))))
|
rlm@347
|
54
|
rlm@347
|
55
|
rlm@347
|
56
|
rlm@347
|
57
|
rlm@347
|
58 #+end_src
|
rlm@343
|
59
|
rlm@343
|
60
|
rlm@343
|
61
|
rlm@343
|
62
|
rlm@343
|
63
|
rlm@343
|
64
|
rlm@343
|
65 * Headers
|
rlm@343
|
66 #+name: joint-header
|
rlm@343
|
67 #+begin_src clojure
|
rlm@343
|
68 (ns cortex.joint
|
rlm@347
|
69 (:require cortex.import)
|
rlm@347
|
70 (:use (cortex world util import body sense
|
rlm@347
|
71 hearing touch vision proprioception movement))
|
rlm@347
|
72 (:import java.io.File)
|
rlm@347
|
73 (:import (com.aurellem.capture RatchetTimer IsoTimer)))
|
rlm@347
|
74
|
rlm@343
|
75
|
rlm@343
|
76 (cortex.import/mega-import-jme3)
|
rlm@346
|
77 (rlm.rlm-commands/help)
|
rlm@343
|
78 #+end_src
|
rlm@343
|
79
|
rlm@343
|
80
|
rlm@343
|
81 * COMMENT Generate Source
|
rlm@343
|
82
|
rlm@343
|
83 #+begin_src clojure :tangle ../src/cortex/joint.clj
|
rlm@343
|
84 <<joint-header>>
|
rlm@347
|
85 <<load-creature>>
|
rlm@343
|
86 #+end_src
|
rlm@346
|
87
|