view org/joint.org @ 351:0596613e5a41

evened out touch sensor sensitivity in joint creature model.
author Robert McIntyre <rlm@mit.edu>
date Mon, 23 Jul 2012 07:59:55 -0500
parents d2806d5c5f74
children d9128eb5f42e
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 joint-creature []
34 (load-blender-model joint))
36 (defn test-joint-creature []
37 (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
38 creature (doto (joint-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 ;;(speed-up world)
66 (light-up-everything world)
67 (let [timer (RatchetTimer. 60)]
68 (.setTimer world timer)
69 (display-dilated-time world timer)))
70 (fn [world tpf]
71 (.setLocalTranslation me (.getLocation (.getCamera world)))
72 (fix-display world)))))
73 #+end_src
75 * Headers
76 #+name: joint-header
77 #+begin_src clojure
78 (ns cortex.joint
79 (:require cortex.import)
80 (:use (cortex world util import body sense
81 hearing touch vision proprioception movement))
82 (:import java.io.File)
83 (:import (com.aurellem.capture RatchetTimer IsoTimer)))
85 (cortex.import/mega-import-jme3)
86 (rlm.rlm-commands/help)
87 #+end_src
90 * COMMENT Generate Source
92 #+begin_src clojure :tangle ../src/cortex/joint.clj
93 <<joint-header>>
94 <<load-creature>>
95 #+end_src