Mercurial > cortex
comparison org/proprioception.org @ 258:f4b67005b702
reorganized proprioception
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 14 Feb 2012 00:39:16 -0700 |
parents | 5d7961d7fded |
children | 7cac5ef852e3 |
comparison
equal
deleted
inserted
replaced
257:5d7961d7fded | 258:f4b67005b702 |
---|---|
34 joint from the rest position defined in the blender file. This | 34 joint from the rest position defined in the blender file. This |
35 simulates the muscle-spindles and joint capsules. I will deal with | 35 simulates the muscle-spindles and joint capsules. I will deal with |
36 Golgi tendon organs, which calculate muscle strain, in the [[./movement.org][next post]]. | 36 Golgi tendon organs, which calculate muscle strain, in the [[./movement.org][next post]]. |
37 | 37 |
38 * Helper Functions | 38 * Helper Functions |
39 | |
40 | 39 |
41 #+name: helpers | 40 #+name: helpers |
42 #+begin_src clojure | 41 #+begin_src clojure |
43 (in-ns 'cortex.proprioception) | 42 (in-ns 'cortex.proprioception) |
44 | 43 |
56 [vec1 vec2 axis] | 55 [vec1 vec2 axis] |
57 (let [angle (.angleBetween vec1 vec2)] | 56 (let [angle (.angleBetween vec1 vec2)] |
58 (if (right-handed? vec1 vec2 axis) | 57 (if (right-handed? vec1 vec2 axis) |
59 angle (- (* 2 Math/PI) angle)))) | 58 angle (- (* 2 Math/PI) angle)))) |
60 #+end_src | 59 #+end_src |
60 | |
61 * Proprioception Kernel | |
61 | 62 |
62 #+name: proprioception | 63 #+name: proprioception |
63 #+begin_src clojure | 64 #+begin_src clojure |
64 (defn proprioception-kernel | 65 (defn proprioception-kernel |
65 "Returns a function which returns proprioceptive sensory data when | 66 "Returns a function which returns proprioceptive sensory data when |
109 (let [senses (map (partial proprioception-kernel creature) | 110 (let [senses (map (partial proprioception-kernel creature) |
110 (joints creature))] | 111 (joints creature))] |
111 (fn [] | 112 (fn [] |
112 (map #(%) senses)))) | 113 (map #(%) senses)))) |
113 #+end_src | 114 #+end_src |
115 | |
116 * Visualizing Proprioception | |
114 | 117 |
115 #+name: visualize | 118 #+name: visualize |
116 #+begin_src clojure | 119 #+begin_src clojure |
117 (in-ns 'cortex.proprioception) | 120 (in-ns 'cortex.proprioception) |
118 | 121 |
172 display each element of the list to the screen as an image." | 175 display each element of the list to the screen as an image." |
173 [] | 176 [] |
174 (view-sense proprioception-display-kernel)) | 177 (view-sense proprioception-display-kernel)) |
175 #+end_src | 178 #+end_src |
176 | 179 |
177 #+name: proprioception-header | 180 * Demonstration of Proprioception |
178 #+begin_src clojure | |
179 (ns cortex.proprioception | |
180 "Simulate the sense of proprioception (ability to detect the | |
181 relative positions of body parts with repsect to other body parts) | |
182 in jMonkeyEngine3. Reads specially prepared blender files to | |
183 automatically generate proprioceptive senses." | |
184 (:use (cortex world util sense body)) | |
185 (:use clojure.contrib.def) | |
186 (:import com.jme3.scene.Node) | |
187 (:import java.awt.image.BufferedImage) | |
188 (:import (com.jme3.math Vector3f Quaternion))) | |
189 #+end_src | |
190 | 181 |
191 #+name: test-body | 182 #+name: test-body |
192 #+begin_src clojure | 183 #+begin_src clojure |
193 (defn test-proprioception | 184 (defn test-proprioception |
194 "Testing proprioception: | 185 "Testing proprioception: |
276 (fn [world] | 267 (fn [world] |
277 (.setTimer world (com.aurellem.capture.RatchetTimer. 60)) | 268 (.setTimer world (com.aurellem.capture.RatchetTimer. 60)) |
278 (set-gravity world (Vector3f. 0 0 0)) | 269 (set-gravity world (Vector3f. 0 0 0)) |
279 (light-up-everything world)) | 270 (light-up-everything world)) |
280 (fn [_ _] (prop-view (list (prop))))])))))) | 271 (fn [_ _] (prop-view (list (prop))))])))))) |
281 | 272 #+end_src |
273 | |
274 * Headers | |
275 #+name: proprioception-header | |
276 #+begin_src clojure | |
277 (ns cortex.proprioception | |
278 "Simulate the sense of proprioception (ability to detect the | |
279 relative positions of body parts with repsect to other body parts) | |
280 in jMonkeyEngine3. Reads specially prepared blender files to | |
281 automatically generate proprioceptive senses." | |
282 (:use (cortex world util sense body)) | |
283 (:use clojure.contrib.def) | |
284 (:import com.jme3.scene.Node) | |
285 (:import java.awt.image.BufferedImage) | |
286 (:import (com.jme3.math Vector3f Quaternion))) | |
282 #+end_src | 287 #+end_src |
283 | 288 |
284 | 289 |
285 * COMMENT generate source | 290 * COMMENT generate source |
286 #+begin_src clojure :tangle ../src/cortex/proprioception.clj | 291 #+begin_src clojure :tangle ../src/cortex/proprioception.clj |