view org/joint.org @ 350:d2806d5c5f74

change distribution of muscles for joint creature
author Robert McIntyre <rlm@mit.edu>
date Mon, 23 Jul 2012 07:41:12 -0500
parents 5405f369f4a0
children 0596613e5a41
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
9 the world the argument, each of which returns [topology data]. Each
10 element of data is a number between 0 and 255 representing the
11 intensity of the light recieved at that sensor.
13 proprioception -- list of nullary functions, one for each joint, which
14 return [heding pitch roll].
16 movement -- list of functions, one for each muscle, which must be
17 called with an integer between 0 and the total number of muscle fibers
18 in the muscle. Each function returns a float which is (current-force/
19 total-possible-force).
21 touch -- list of functions which must each be called with a Node
22 (normally the root node of the simulation) the argument, each of which
23 returns [topology data]. Each element of data is a posive float
24 between 0.0 and the max length of the "hairs" of which the touch sense
25 is composed.
27 #+name: load-creature
28 #+begin_src clojure
29 (in-ns 'cortex.joint)
31 (def joint "Models/joint/joint.blend")
33 (defn load-creature []
34 (load-blender-model joint))
36 (defn test-creature []
37 (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
38 creature (doto (load-creature) (body!))
40 ;;;;;;;;;;;; Sensors/Effectors ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
41 touch (touch! creature)
42 touch-display (view-touch)
44 vision (vision! creature)
45 vision-display (view-vision)
47 ;;hearing (hearing! creature)
48 ;;hearing-display (view-hearing)
50 prop (proprioception! creature)
51 prop-display (view-proprioception)
53 muscles (movement! creature)
54 muscle-display (view-movement)
55 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57 fix-display (gen-fix-display)
59 floor (box 10 2 10 :position (Vector3f. 0 -9 0)
60 :color ColorRGBA/Gray :mass 0)]
61 (world
62 (nodify [floor me creature])
63 standard-debug-controls
64 (fn [world]
65 (let [timer (RatchetTimer. 60)]
66 (.setTimer world timer)
67 (display-dilated-time world timer)))
68 (fn [world tpf]
69 (.setLocalTranslation me (.getLocation (.getCamera world)))
70 (fix-display world)))))
71 #+end_src
73 * Headers
74 #+name: joint-header
75 #+begin_src clojure
76 (ns cortex.joint
77 (:require cortex.import)
78 (:use (cortex world util import body sense
79 hearing touch vision proprioception movement))
80 (:import java.io.File)
81 (:import (com.aurellem.capture RatchetTimer IsoTimer)))
83 (cortex.import/mega-import-jme3)
84 (rlm.rlm-commands/help)
85 #+end_src
88 * COMMENT Generate Source
90 #+begin_src clojure :tangle ../src/cortex/joint.clj
91 <<joint-header>>
92 <<load-creature>>
93 #+end_src