annotate 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
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@351 33 (defn joint-creature []
rlm@347 34 (load-blender-model joint))
rlm@347 35
rlm@351 36 (defn test-joint-creature []
rlm@347 37 (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
rlm@351 38 creature (doto (joint-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@351 65 ;;(speed-up world)
rlm@351 66 (light-up-everything world)
rlm@348 67 (let [timer (RatchetTimer. 60)]
rlm@348 68 (.setTimer world timer)
rlm@348 69 (display-dilated-time world timer)))
rlm@347 70 (fn [world tpf]
rlm@348 71 (.setLocalTranslation me (.getLocation (.getCamera world)))
rlm@347 72 (fix-display world)))))
rlm@347 73 #+end_src
rlm@343 74
rlm@343 75 * Headers
rlm@343 76 #+name: joint-header
rlm@343 77 #+begin_src clojure
rlm@343 78 (ns cortex.joint
rlm@347 79 (:require cortex.import)
rlm@347 80 (:use (cortex world util import body sense
rlm@347 81 hearing touch vision proprioception movement))
rlm@347 82 (:import java.io.File)
rlm@347 83 (:import (com.aurellem.capture RatchetTimer IsoTimer)))
rlm@347 84
rlm@343 85 (cortex.import/mega-import-jme3)
rlm@346 86 (rlm.rlm-commands/help)
rlm@343 87 #+end_src
rlm@343 88
rlm@343 89
rlm@343 90 * COMMENT Generate Source
rlm@343 91
rlm@343 92 #+begin_src clojure :tangle ../src/cortex/joint.clj
rlm@343 93 <<joint-header>>
rlm@347 94 <<load-creature>>
rlm@343 95 #+end_src
rlm@346 96