Mercurial > cortex
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 joint5 The point of this joint is that it uses exploratory motor movements to6 learn how to move to any particular position.8 visual-information -- list of functions which must each be called with9 the world the argument, each of which returns [topology data]. Each10 element of data is a number between 0 and 255 representing the11 intensity of the light recieved at that sensor.13 proprioception -- list of nullary functions, one for each joint, which14 return [heding pitch roll].16 movement -- list of functions, one for each muscle, which must be17 called with an integer between 0 and the total number of muscle fibers18 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 Node22 (normally the root node of the simulation) the argument, each of which23 returns [topology data]. Each element of data is a posive float24 between 0.0 and the max length of the "hairs" of which the touch sense25 is composed.27 #+name: load-creature28 #+begin_src clojure29 (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 (world62 (nodify [floor me creature])63 standard-debug-controls64 (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_src73 * Headers74 #+name: joint-header75 #+begin_src clojure76 (ns cortex.joint77 (:require cortex.import)78 (:use (cortex world util import body sense79 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_src88 * COMMENT Generate Source90 #+begin_src clojure :tangle ../src/cortex/joint.clj91 <<joint-header>>92 <<load-creature>>93 #+end_src