view 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
line wrap: on
line source


3 * A joint
5 The point of this joint is that it uses exploratory motor movements to
6 learn how to move to any particular position.
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.
13 proprioception -- list of nullary functions, one for each joint, which
14 return [heding pitch roll].
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.
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).
28 #+name: load-creature
29 #+begin_src clojure
30 (in-ns 'cortex.joint)
32 (def joint "Models/joint/joint.blend")
34 (defn load-creature []
35 (load-blender-model joint))
41 (defn test-creature []
42 (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
43 creature (doto (load-creature) (body!))
45 ;;;;;;;;;;;; Sensors/Effectors ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
46 touch (touch! creature)
47 touch-display (view-touch)
49 vision (vision! creature)
50 vision-display (view-vision)
52 ;;hearing (hearing! creature)
53 ;;hearing-display (view-hearing)
55 prop (proprioception! creature)
56 prop-display (view-proprioception)
58 muscles (movement! creature)
59 muscle-display (view-movement)
60 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
62 fix-display (gen-fix-display)
64 floor (box 10 2 10 :position (Vector3f. 0 -9 0)
65 :color ColorRGBA/Gray :mass 0)]
66 (world
67 (nodify [floor me creature])
68 standard-debug-controls
69 (fn [world]
70 (let [timer (RatchetTimer. 60)]
71 (.setTimer world timer)
72 (display-dilated-time world timer)))
73 (fn [world tpf]
74 (.setLocalTranslation me (.getLocation (.getCamera world)))
75 (fix-display world)))))
80 #+end_src
87 * Headers
88 #+name: joint-header
89 #+begin_src clojure
90 (ns cortex.joint
91 (:require cortex.import)
92 (:use (cortex world util import body sense
93 hearing touch vision proprioception movement))
94 (:import java.io.File)
95 (:import (com.aurellem.capture RatchetTimer IsoTimer)))
98 (cortex.import/mega-import-jme3)
99 (rlm.rlm-commands/help)
100 #+end_src
103 * COMMENT Generate Source
105 #+begin_src clojure :tangle ../src/cortex/joint.clj
106 <<joint-header>>
107 <<load-creature>>
108 #+end_src