annotate org/joint.org @ 413:54ef2e06c3ef

gave main worm a consistent muscle order.
author Robert McIntyre <rlm@mit.edu>
date Wed, 19 Mar 2014 14:24:13 -0400
parents d9128eb5f42e
children
rev   line source
rlm@352 1 * Summary of Senses
rlm@346 2
rlm@352 3 vision -- list of functions which must each be called with
rlm@352 4 the world as their argument, each of which returns [topology data]. Each
rlm@350 5 element of data is a number between 0 and 255 representing the
rlm@352 6 intensity of the light recieved at that sensor. Each element of
rlm@352 7 topology is a pair of numbers [x, y] such that numbers whose pairs
rlm@352 8 have a short euclidean distance are generally physically close on the
rlm@352 9 actual sensor.
rlm@348 10
rlm@348 11 proprioception -- list of nullary functions, one for each joint, which
rlm@348 12 return [heding pitch roll].
rlm@348 13
rlm@350 14 movement -- list of functions, one for each muscle, which must be
rlm@350 15 called with an integer between 0 and the total number of muscle fibers
rlm@350 16 in the muscle. Each function returns a float which is (current-force/
rlm@350 17 total-possible-force).
rlm@350 18
rlm@348 19 touch -- list of functions which must each be called with a Node
rlm@348 20 (normally the root node of the simulation) the argument, each of which
rlm@352 21 returns [topology data]. Each element of data is [length limit] where
rlm@352 22 limit is the length of that particular "hair" and length is the amount
rlm@352 23 of the hair that has been activated so far. (= limit length) means that
rlm@352 24 nothing is touching the hair.
rlm@352 25
rlm@352 26
rlm@352 27 * A Flower
rlm@352 28
rlm@352 29 A flower is a basic creature that tries to maximize the amount of
rlm@352 30 light that it sees. It can have one or more eyes, with one eye being
rlm@352 31 "special" in that it is this eye which must recieve maximum light. It
rlm@352 32 can have multiple articulated joints and mulcles.
rlm@352 33
rlm@352 34 Want an algorithm that uses the sense data of =vision=
rlm@352 35 =proprioception=, and =movement= to maximum benefit in order to look
rlm@352 36 at the light source.
rlm@352 37
rlm@352 38 The light source will move from place to place and the flower will
rlm@352 39 have to follow it.
rlm@352 40
rlm@352 41 The algorithm should be generalize to any number of eyes and muscles,
rlm@352 42 and should become /more/ preformant the more sensory data is
rlm@352 43 available.
rlm@352 44
rlm@352 45 I will punt on working out an elegant model of motivation for the
rlm@352 46 flower which makes it want to go to the light.
rlm@352 47
rlm@352 48 Maybe I need a motivationless entity first, which just learns how its
rlm@352 49 own body works? But then, wouldn't that just be a motivation itself?
rlm@352 50
rlm@352 51
rlm@352 52
rlm@352 53
rlm@348 54
rlm@347 55 #+name: load-creature
rlm@347 56 #+begin_src clojure
rlm@347 57 (in-ns 'cortex.joint)
rlm@343 58
rlm@347 59 (def joint "Models/joint/joint.blend")
rlm@347 60
rlm@351 61 (defn joint-creature []
rlm@347 62 (load-blender-model joint))
rlm@347 63
rlm@351 64 (defn test-joint-creature []
rlm@347 65 (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
rlm@351 66 creature (doto (joint-creature) (body!))
rlm@347 67
rlm@347 68 ;;;;;;;;;;;; Sensors/Effectors ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rlm@347 69 touch (touch! creature)
rlm@347 70 touch-display (view-touch)
rlm@347 71
rlm@348 72 vision (vision! creature)
rlm@348 73 vision-display (view-vision)
rlm@347 74
rlm@347 75 ;;hearing (hearing! creature)
rlm@347 76 ;;hearing-display (view-hearing)
rlm@347 77
rlm@347 78 prop (proprioception! creature)
rlm@347 79 prop-display (view-proprioception)
rlm@347 80
rlm@347 81 muscles (movement! creature)
rlm@347 82 muscle-display (view-movement)
rlm@347 83 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rlm@347 84
rlm@347 85 fix-display (gen-fix-display)
rlm@347 86
rlm@347 87 floor (box 10 2 10 :position (Vector3f. 0 -9 0)
rlm@348 88 :color ColorRGBA/Gray :mass 0)]
rlm@347 89 (world
rlm@347 90 (nodify [floor me creature])
rlm@347 91 standard-debug-controls
rlm@347 92 (fn [world]
rlm@351 93 ;;(speed-up world)
rlm@351 94 (light-up-everything world)
rlm@348 95 (let [timer (RatchetTimer. 60)]
rlm@348 96 (.setTimer world timer)
rlm@348 97 (display-dilated-time world timer)))
rlm@347 98 (fn [world tpf]
rlm@348 99 (.setLocalTranslation me (.getLocation (.getCamera world)))
rlm@347 100 (fix-display world)))))
rlm@347 101 #+end_src
rlm@343 102
rlm@343 103 * Headers
rlm@343 104 #+name: joint-header
rlm@343 105 #+begin_src clojure
rlm@343 106 (ns cortex.joint
rlm@347 107 (:require cortex.import)
rlm@347 108 (:use (cortex world util import body sense
rlm@347 109 hearing touch vision proprioception movement))
rlm@347 110 (:import java.io.File)
rlm@347 111 (:import (com.aurellem.capture RatchetTimer IsoTimer)))
rlm@347 112
rlm@343 113 (cortex.import/mega-import-jme3)
rlm@346 114 (rlm.rlm-commands/help)
rlm@343 115 #+end_src
rlm@343 116
rlm@343 117
rlm@343 118 * COMMENT Generate Source
rlm@343 119
rlm@343 120 #+begin_src clojure :tangle ../src/cortex/joint.clj
rlm@343 121 <<joint-header>>
rlm@347 122 <<load-creature>>
rlm@343 123 #+end_src
rlm@346 124