annotate 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
rev   line source
rlm@346 1
rlm@346 2
rlm@348 3 * A joint
rlm@348 4
rlm@348 5 The point of this joint is that it uses exploratory motor movements to
rlm@348 6 learn how to move to any particular position.
rlm@348 7
rlm@350 8 visual-information -- list of functions which must each be called with
rlm@350 9 the world the argument, each of which returns [topology data]. Each
rlm@350 10 element of data is a number between 0 and 255 representing the
rlm@350 11 intensity of the light recieved at that sensor.
rlm@348 12
rlm@348 13 proprioception -- list of nullary functions, one for each joint, which
rlm@348 14 return [heding pitch roll].
rlm@348 15
rlm@350 16 movement -- list of functions, one for each muscle, which must be
rlm@350 17 called with an integer between 0 and the total number of muscle fibers
rlm@350 18 in the muscle. Each function returns a float which is (current-force/
rlm@350 19 total-possible-force).
rlm@350 20
rlm@348 21 touch -- list of functions which must each be called with a Node
rlm@348 22 (normally the root node of the simulation) the argument, each of which
rlm@348 23 returns [topology data]. Each element of data is a posive float
rlm@348 24 between 0.0 and the max length of the "hairs" of which the touch sense
rlm@348 25 is composed.
rlm@348 26
rlm@347 27 #+name: load-creature
rlm@347 28 #+begin_src clojure
rlm@347 29 (in-ns 'cortex.joint)
rlm@343 30
rlm@347 31 (def joint "Models/joint/joint.blend")
rlm@347 32
rlm@347 33 (defn load-creature []
rlm@347 34 (load-blender-model joint))
rlm@347 35
rlm@347 36 (defn test-creature []
rlm@347 37 (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
rlm@347 38 creature (doto (load-creature) (body!))
rlm@347 39
rlm@347 40 ;;;;;;;;;;;; Sensors/Effectors ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rlm@347 41 touch (touch! creature)
rlm@347 42 touch-display (view-touch)
rlm@347 43
rlm@348 44 vision (vision! creature)
rlm@348 45 vision-display (view-vision)
rlm@347 46
rlm@347 47 ;;hearing (hearing! creature)
rlm@347 48 ;;hearing-display (view-hearing)
rlm@347 49
rlm@347 50 prop (proprioception! creature)
rlm@347 51 prop-display (view-proprioception)
rlm@347 52
rlm@347 53 muscles (movement! creature)
rlm@347 54 muscle-display (view-movement)
rlm@347 55 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rlm@347 56
rlm@347 57 fix-display (gen-fix-display)
rlm@347 58
rlm@347 59 floor (box 10 2 10 :position (Vector3f. 0 -9 0)
rlm@348 60 :color ColorRGBA/Gray :mass 0)]
rlm@347 61 (world
rlm@347 62 (nodify [floor me creature])
rlm@347 63 standard-debug-controls
rlm@347 64 (fn [world]
rlm@348 65 (let [timer (RatchetTimer. 60)]
rlm@348 66 (.setTimer world timer)
rlm@348 67 (display-dilated-time world timer)))
rlm@347 68 (fn [world tpf]
rlm@348 69 (.setLocalTranslation me (.getLocation (.getCamera world)))
rlm@347 70 (fix-display world)))))
rlm@347 71 #+end_src
rlm@343 72
rlm@343 73 * Headers
rlm@343 74 #+name: joint-header
rlm@343 75 #+begin_src clojure
rlm@343 76 (ns cortex.joint
rlm@347 77 (:require cortex.import)
rlm@347 78 (:use (cortex world util import body sense
rlm@347 79 hearing touch vision proprioception movement))
rlm@347 80 (:import java.io.File)
rlm@347 81 (:import (com.aurellem.capture RatchetTimer IsoTimer)))
rlm@347 82
rlm@343 83 (cortex.import/mega-import-jme3)
rlm@346 84 (rlm.rlm-commands/help)
rlm@343 85 #+end_src
rlm@343 86
rlm@343 87
rlm@343 88 * COMMENT Generate Source
rlm@343 89
rlm@343 90 #+begin_src clojure :tangle ../src/cortex/joint.clj
rlm@343 91 <<joint-header>>
rlm@347 92 <<load-creature>>
rlm@343 93 #+end_src
rlm@346 94