Mercurial > cortex
view org/body.org @ 134:ac350a0ac6b0
proprioception refrence frame is wrong, trying to fix...
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 01 Feb 2012 02:44:07 -0700 |
parents | 2ed7e60d3821 |
children | 421cc43441ae |
line wrap: on
line source
1 #+title: The BODY!!!2 #+author: Robert McIntyre3 #+email: rlm@mit.edu4 #+description: Simulating a body (movement, touch, propioception) in jMonkeyEngine3.5 #+SETUPFILE: ../../aurellem/org/setup.org6 #+INCLUDE: ../../aurellem/org/level-0.org8 * Proprioception9 #+name: proprioception10 #+begin_src clojure11 (ns cortex.body12 (:use (cortex world util))13 (:import14 com.jme3.math.Vector3f15 com.jme3.math.Quaternion16 com.jme3.math.Vector2f17 com.jme3.math.Matrix3f18 com.jme3.bullet.control.RigidBodyControl))20 (import com.jme3.scene.Node)22 (defn joint-proprioception [#^Node parts #^Node joint]23 (let [[obj-a obj-b] (cortex.silly/joint-targets parts joint)24 joint-rot (.getWorldRotation joint)25 x (.mult joint-rot Vector3f/UNIT_X)26 y (.mult joint-rot Vector3f/UNIT_Y)27 z (.mult joint-rot Vector3f/UNIT_Z)]28 ;; this function will report proprioceptive information for the29 ;; joint30 (fn []31 ;; x is the "twist" axis, y and z are the "bend" axes32 (let [rot-a (.getWorldRotation obj-a)33 rot-b (.getWorldRotation obj-b)34 relative (.mult (.inverse rot-a) rot-b)35 basis (doto (Matrix3f.)36 (.setColumn 0 x)37 (.setColumn 1 y)38 (.setColumn 2 z))39 rotation-about-joint40 (doto (Quaternion.)41 (.fromRotationMatrix42 (.mult (.invert basis)43 (.toRotationMatrix relative))))44 [yaw roll pitch]45 (seq (.toAngles rotation-about-joint nil))]46 ;;return euler angles of the quaternion around the new basis47 ;;[yaw pitch roll]48 [yaw roll pitch]49 ))))52 (defn proprioception53 "Create a function that provides proprioceptive information about an54 entire body."55 [#^Node creature]56 ;; extract the body's joints57 (let [joints (cortex.silly/creature-joints creature)58 senses (map (partial joint-proprioception creature) joints)]59 (fn []60 (map #(%) senses))))62 #+end_src64 #+results: proprioception65 : #'cortex.body/proprioception67 * Motor Control68 #+name: motor-control69 #+begin_src clojure70 (in-ns 'cortex.body)72 ;; surprisingly enough, terristerial creatures only move by using73 ;; torque applied about their joints. There's not a single straight74 ;; line of force in the human body at all! (A straight line of force75 ;; would correspond to some sort of jet or rocket propulseion.)77 (defn vector-motor-control78 "Create a function that accepts a sequence of Vector3f objects that79 describe the torque to be applied to each part of the body."80 [body]81 (let [nodes (node-seq body)82 controls (keep #(.getControl % RigidBodyControl) nodes)]83 (fn [torques]84 (map #(.applyTorque %1 %2)85 controls torques))))86 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;87 #+end_src89 ## note -- might want to add a lower dimensional, discrete version of90 ## this if it proves useful from a x-modal clustering perspective.92 * Examples94 #+name: test-body95 #+begin_src clojure96 (ns cortex.test.body97 (:use (cortex world util body))98 (:import99 com.jme3.math.Vector3f100 com.jme3.math.ColorRGBA101 com.jme3.bullet.joints.Point2PointJoint102 com.jme3.bullet.control.RigidBodyControl103 com.jme3.system.NanoTimer))105 (defn worm-segments106 "Create multiple evenly spaced box segments. They're fabulous!"107 [segment-length num-segments interstitial-space radius]108 (letfn [(nth-segment109 [n]110 (box segment-length radius radius :mass 0.1111 :position112 (Vector3f.113 (* 2 n (+ interstitial-space segment-length)) 0 0)114 :name (str "worm-segment" n)115 :color (ColorRGBA/randomColor)))]116 (map nth-segment (range num-segments))))118 (defn connect-at-midpoint119 "Connect two physics objects with a Point2Point joint constraint at120 the point equidistant from both objects' centers."121 [segmentA segmentB]122 (let [centerA (.getWorldTranslation segmentA)123 centerB (.getWorldTranslation segmentB)124 midpoint (.mult (.add centerA centerB) (float 0.5))125 pivotA (.subtract midpoint centerA)126 pivotB (.subtract midpoint centerB)128 ;; A side-effect of creating a joint registers129 ;; it with both physics objects which in turn130 ;; will register the joint with the physics system131 ;; when the simulation is started.132 joint (Point2PointJoint.133 (.getControl segmentA RigidBodyControl)134 (.getControl segmentB RigidBodyControl)135 pivotA136 pivotB)]137 segmentB))139 (defn eve-worm140 "Create a worm-like body bound by invisible joint constraints."141 []142 (let [segments (worm-segments 0.2 5 0.1 0.1)]143 (dorun (map (partial apply connect-at-midpoint)144 (partition 2 1 segments)))145 (nodify "worm" segments)))147 (defn worm-pattern148 "This is a simple, mindless motor control pattern that drives the149 second segment of the worm's body at an offset angle with150 sinusoidally varying strength."151 [time]152 (let [angle (* Math/PI (/ 9 20))153 direction (Vector3f. 0 (Math/sin angle) (Math/cos angle))]154 [Vector3f/ZERO155 (.mult156 direction157 (float (* 2 (Math/sin (* Math/PI 2 (/ (rem time 300 ) 300))))))158 Vector3f/ZERO159 Vector3f/ZERO160 Vector3f/ZERO]))162 (defn test-motor-control163 "Testing motor-control:164 You should see a multi-segmented worm-like object fall onto the165 table and begin writhing and moving."166 []167 (let [worm (eve-worm)168 time (atom 0)169 worm-motor-map (vector-motor-control worm)]170 (world171 (nodify [worm172 (box 10 0.5 10 :position (Vector3f. 0 -5 0) :mass 0173 :color ColorRGBA/Gray)])174 standard-debug-controls175 (fn [world]176 (enable-debug world)177 (light-up-everything world)178 (comment179 (com.aurellem.capture.Capture/captureVideo180 world181 (file-str "/home/r/proj/cortex/tmp/moving-worm")))182 )184 (fn [_ _]185 (swap! time inc)186 (Thread/sleep 20)187 (dorun (worm-motor-map188 (worm-pattern @time)))))))191 (require 'cortex.silly)192 (defn join-at-point [obj-a obj-b world-pivot]193 (cortex.silly/joint-dispatch194 {:type :point}195 (.getControl obj-a RigidBodyControl)196 (.getControl obj-b RigidBodyControl)197 (cortex.silly/world-to-local obj-a world-pivot)198 (cortex.silly/world-to-local obj-b world-pivot)199 nil200 ))202 (import com.jme3.bullet.collision.PhysicsCollisionObject)204 (defn blab-* []205 (let [hand (box 0.5 0.2 0.2 :position (Vector3f. 0 0 0)206 :mass 0 :color ColorRGBA/Green)207 finger (box 0.5 0.2 0.2 :position (Vector3f. 2.4 0 0)208 :mass 1 :color ColorRGBA/Red)209 connection-point (Vector3f. 1.2 0 0)210 root (nodify [hand finger])]212 (join-at-point hand finger (Vector3f. 1.2 0 0))214 (.setCollisionGroup215 (.getControl hand RigidBodyControl)216 PhysicsCollisionObject/COLLISION_GROUP_NONE)217 (world218 root219 standard-debug-controls220 (fn [world]221 (enable-debug world)222 (.setTimer world (com.aurellem.capture.RatchetTimer. 60))223 (set-gravity world Vector3f/ZERO)224 )225 no-op)))226 (import java.awt.image.BufferedImage)228 (defn draw-sprite [image sprite x y color ]229 (dorun230 (for [[u v] sprite]231 (.setRGB image (+ u x) (+ v y) color))))233 (defn view-angle234 "create a debug view of an angle"235 [color]236 (let [image (BufferedImage. 50 50 BufferedImage/TYPE_INT_RGB)237 previous (atom [25 25])238 sprite [[0 0] [0 1]239 [0 -1] [-1 0] [1 0]]]240 (fn [angle]241 (let [angle (float angle)]242 (let [position243 [(+ 25 (int (* 20 (Math/cos angle))))244 (+ 25 (int (* 20(Math/sin angle))))]]245 (draw-sprite image sprite (@previous 0) (@previous 1) 0x000000)246 (draw-sprite image sprite (position 0) (position 1) color)247 (reset! previous position))248 image))))250 (defn proprioception-debug-window251 []252 (let [yaw (view-angle 0xFF0000)253 roll (view-angle 0x00FF00)254 pitch (view-angle 0xFFFFFF)255 v-yaw (view-image)256 v-roll (view-image)257 v-pitch (view-image)258 ]259 (fn [prop-data]260 (dorun261 (map262 (fn [[y r p]]263 (v-yaw (yaw y))264 (v-roll (roll r))265 (v-pitch (pitch p)))266 prop-data)))))267 (comment269 (defn proprioception-debug-window270 []271 (let [time (atom 0)]272 (fn [prop-data]273 (if (= 0 (rem (swap! time inc) 40))274 (println-repl prop-data)))))275 )277 (comment278 (dorun279 (map280 (comp281 println-repl282 (fn [[p y r]]283 (format284 "pitch: %1.2f\nyaw: %1.2f\nroll: %1.2f\n"285 p y r)))286 prop-data)))292 (defn test-proprioception293 "Testing proprioception:294 You should see two foating bars, and a printout of pitch, yaw, and295 roll. Pressing key-r/key-t should move the blue bar up and down and296 change only the value of pitch. key-f/key-g moves it side to side297 and changes yaw. key-v/key-b will spin the blue segment clockwise298 and counterclockwise, and only affect roll."299 []300 (let [hand (box 1 0.2 0.2 :position (Vector3f. 0 2 0)301 :mass 0 :color ColorRGBA/Green :name "hand")302 finger (box 1 0.2 0.2 :position (Vector3f. 2.4 2 0)303 :mass 1 :color ColorRGBA/Red :name "finger")304 floor (box 10 10 10 :position (Vector3f. 0 -15 0)305 :mass 0 :color ColorRGBA/Gray)306 joint-node (box 0.1 0.05 0.05 :color ColorRGBA/Yellow307 :position (Vector3f. 1.2 2 0)308 :physical? false)310 move-up? (atom false)311 move-down? (atom false)312 move-left? (atom false)313 move-right? (atom false)314 roll-left? (atom false)315 roll-right? (atom false)316 control (.getControl finger RigidBodyControl)317 time (atom 0)318 joint (join-at-point hand finger (Vector3f. 1.2 2 0 ))319 creature (nodify [hand finger joint-node])320 prop (joint-proprioception creature joint-node)322 prop-view (proprioception-debug-window)325 ]330 (.setCollisionGroup331 (.getControl hand RigidBodyControl)332 PhysicsCollisionObject/COLLISION_GROUP_NONE)335 (world336 (nodify [hand finger floor joint-node])337 (merge standard-debug-controls338 {"key-r" (fn [_ pressed?] (reset! move-up? pressed?))339 "key-t" (fn [_ pressed?] (reset! move-down? pressed?))340 "key-f" (fn [_ pressed?] (reset! move-left? pressed?))341 "key-g" (fn [_ pressed?] (reset! move-right? pressed?))342 "key-v" (fn [_ pressed?] (reset! roll-left? pressed?))343 "key-b" (fn [_ pressed?] (reset! roll-right? pressed?))})344 (fn [world]345 (.setTimer world (com.aurellem.capture.RatchetTimer. 60))346 (set-gravity world (Vector3f. 0 0 0))347 (light-up-everything world))348 (fn [_ _]349 (if @move-up?350 (.applyTorque control351 (.mult (.getPhysicsRotation control)352 (Vector3f. 0 0 10))))353 (if @move-down?354 (.applyTorque control355 (.mult (.getPhysicsRotation control)356 (Vector3f. 0 0 -10))))357 (if @move-left?358 (.applyTorque control359 (.mult (.getPhysicsRotation control)360 (Vector3f. 0 10 0))))361 (if @move-right?362 (.applyTorque control363 (.mult (.getPhysicsRotation control)364 (Vector3f. 0 -10 0))))365 (if @roll-left?366 (.applyTorque control367 (.mult (.getPhysicsRotation control)368 (Vector3f. -1 0 0))))369 (if @roll-right?370 (.applyTorque control371 (.mult (.getPhysicsRotation control)372 (Vector3f. 1 0 0))))374 ;;(if (= 0 (rem (swap! time inc) 20))375 (prop-view (list (prop)))))))377 #+end_src379 #+results: test-body380 : #'cortex.test.body/test-proprioception383 * COMMENT code-limbo384 #+begin_src clojure385 ;;(.loadModel386 ;; (doto (asset-manager)387 ;; (.registerLoader BlenderModelLoader (into-array String ["blend"])))388 ;; "Models/person/person.blend")391 (defn load-blender-model392 "Load a .blend file using an asset folder relative path."393 [^String model]394 (.loadModel395 (doto (asset-manager)396 (.registerLoader BlenderModelLoader (into-array String ["blend"])))397 model))400 (defn view-model [^String model]401 (view402 (.loadModel403 (doto (asset-manager)404 (.registerLoader BlenderModelLoader (into-array String ["blend"])))405 model)))407 (defn load-blender-scene [^String model]408 (.loadModel409 (doto (asset-manager)410 (.registerLoader BlenderLoader (into-array String ["blend"])))411 model))413 (defn worm414 []415 (.loadModel (asset-manager) "Models/anim2/Cube.mesh.xml"))417 (defn oto418 []419 (.loadModel (asset-manager) "Models/Oto/Oto.mesh.xml"))421 (defn sinbad422 []423 (.loadModel (asset-manager) "Models/Sinbad/Sinbad.mesh.xml"))425 (defn worm-blender426 []427 (first (seq (.getChildren (load-blender-model428 "Models/anim2/simple-worm.blend")))))430 (defn body431 "given a node with a SkeletonControl, will produce a body sutiable432 for AI control with movement and proprioception."433 [node]434 (let [skeleton-control (.getControl node SkeletonControl)435 krc (KinematicRagdollControl.)]436 (comment437 (dorun438 (map #(.addBoneName krc %)439 ["mid2" "tail" "head" "mid1" "mid3" "mid4" "Dummy-Root" ""]440 ;;"mid2" "mid3" "tail" "head"]441 )))442 (.addControl node krc)443 (.setRagdollMode krc)444 )445 node446 )447 (defn show-skeleton [node]448 (let [sd450 (doto451 (SkeletonDebugger. "aurellem-skel-debug"452 (skel node))453 (.setMaterial (green-x-ray)))]454 (.attachChild node sd)455 node))459 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;461 ;; this could be a good way to give objects special properties like462 ;; being eyes and the like464 (.getUserData465 (.getChild466 (load-blender-model "Models/property/test.blend") 0)467 "properties")469 ;; the properties are saved along with the blender file.470 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;475 (defn init-debug-skel-node476 [f debug-node skeleton]477 (let [bones478 (map #(.getBone skeleton %)479 (range (.getBoneCount skeleton)))]480 (dorun (map #(.setUserControl % true) bones))481 (dorun (map (fn [b]482 (println (.getName b)483 " -- " (f b)))484 bones))485 (dorun486 (map #(.attachChild487 debug-node488 (doto489 (sphere 0.1490 :position (f %)491 :physical? false)492 (.setMaterial (green-x-ray))))493 bones)))494 debug-node)496 (import jme3test.bullet.PhysicsTestHelper)499 (defn test-zzz [the-worm world value]500 (if (not value)501 (let [skeleton (skel the-worm)]502 (println-repl "enabling bones")503 (dorun504 (map505 #(.setUserControl (.getBone skeleton %) true)506 (range (.getBoneCount skeleton))))509 (let [b (.getBone skeleton 2)]510 (println-repl "moving " (.getName b))511 (println-repl (.getLocalPosition b))512 (.setUserTransforms b513 Vector3f/UNIT_X514 Quaternion/IDENTITY515 ;;(doto (Quaternion.)516 ;; (.fromAngles (/ Math/PI 2)517 ;; 0518 ;; 0520 (Vector3f. 1 1 1))521 )523 (println-repl "hi! <3"))))526 (defn test-ragdoll []528 (let [the-worm530 ;;(.loadModel (asset-manager) "Models/anim2/Cube.mesh.xml")531 (doto (show-skeleton (worm-blender))532 (.setLocalTranslation (Vector3f. 0 10 0))533 ;;(worm)534 ;;(oto)535 ;;(sinbad)536 )537 ]540 (.start541 (world542 (doto (Node.)543 (.attachChild the-worm))544 {"key-return" (fire-cannon-ball)545 "key-space" (partial test-zzz the-worm)546 }547 (fn [world]548 (light-up-everything world)549 (PhysicsTestHelper/createPhysicsTestWorld550 (.getRootNode world)551 (asset-manager)552 (.getPhysicsSpace553 (.getState (.getStateManager world) BulletAppState)))554 (set-gravity world Vector3f/ZERO)555 ;;(.setTimer world (NanoTimer.))556 ;;(org.lwjgl.input.Mouse/setGrabbed false)557 )558 no-op559 )562 )))565 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;566 ;;; here is the ragdoll stuff568 (def worm-mesh (.getMesh (.getChild (worm-blender) 0)))569 (def mesh worm-mesh)571 (.getFloatBuffer mesh VertexBuffer$Type/Position)572 (.getFloatBuffer mesh VertexBuffer$Type/BoneWeight)573 (.getData (.getBuffer mesh VertexBuffer$Type/BoneIndex))576 (defn position [index]577 (.get578 (.getFloatBuffer worm-mesh VertexBuffer$Type/Position)579 index))581 (defn bones [index]582 (.get583 (.getData (.getBuffer mesh VertexBuffer$Type/BoneIndex))584 index))586 (defn bone-weights [index]587 (.get588 (.getFloatBuffer mesh VertexBuffer$Type/BoneWeight)589 index))593 (defn vertex-bones [vertex]594 (vec (map (comp int bones) (range (* vertex 4) (+ (* vertex 4) 4)))))596 (defn vertex-weights [vertex]597 (vec (map (comp float bone-weights) (range (* vertex 4) (+ (* vertex 4) 4)))))599 (defn vertex-position [index]600 (let [offset (* index 3)]601 (Vector3f. (position offset)602 (position (inc offset))603 (position (inc(inc offset))))))605 (def vertex-info (juxt vertex-position vertex-bones vertex-weights))607 (defn bone-control-color [index]608 (get {[1 0 0 0] ColorRGBA/Red609 [1 2 0 0] ColorRGBA/Magenta610 [2 0 0 0] ColorRGBA/Blue}611 (vertex-bones index)612 ColorRGBA/White))614 (defn influence-color [index bone-num]615 (get616 {(float 0) ColorRGBA/Blue617 (float 0.5) ColorRGBA/Green618 (float 1) ColorRGBA/Red}619 ;; find the weight of the desired bone620 ((zipmap (vertex-bones index)(vertex-weights index))621 bone-num)622 ColorRGBA/Blue))624 (def worm-vertices (set (map vertex-info (range 60))))627 (defn test-info []628 (let [points (Node.)]629 (dorun630 (map #(.attachChild points %)631 (map #(sphere 0.01632 :position (vertex-position %)633 :color (influence-color % 1)634 :physical? false)635 (range 60))))636 (view points)))639 (defrecord JointControl [joint physics-space]640 PhysicsControl641 (setPhysicsSpace [this space]642 (dosync643 (ref-set (:physics-space this) space))644 (.addJoint space (:joint this)))645 (update [this tpf])646 (setSpatial [this spatial])647 (render [this rm vp])648 (getPhysicsSpace [this] (deref (:physics-space this)))649 (isEnabled [this] true)650 (setEnabled [this state]))652 (defn add-joint653 "Add a joint to a particular object. When the object is added to the654 PhysicsSpace of a simulation, the joint will also be added"655 [object joint]656 (let [control (JointControl. joint (ref nil))]657 (.addControl object control))658 object)661 (defn hinge-world662 []663 (let [sphere1 (sphere)664 sphere2 (sphere 1 :position (Vector3f. 3 3 3))665 joint (Point2PointJoint.666 (.getControl sphere1 RigidBodyControl)667 (.getControl sphere2 RigidBodyControl)668 Vector3f/ZERO (Vector3f. 3 3 3))]669 (add-joint sphere1 joint)670 (doto (Node. "hinge-world")671 (.attachChild sphere1)672 (.attachChild sphere2))))675 (defn test-joint []676 (view (hinge-world)))678 ;; (defn copier-gen []679 ;; (let [count (atom 0)]680 ;; (fn [in]681 ;; (swap! count inc)682 ;; (clojure.contrib.duck-streams/copy683 ;; in (File. (str "/home/r/tmp/mao-test/clojure-images/"684 ;; ;;/home/r/tmp/mao-test/clojure-images685 ;; (format "%08d.png" @count)))))))686 ;; (defn decrease-framerate []687 ;; (map688 ;; (copier-gen)689 ;; (sort690 ;; (map first691 ;; (partition692 ;; 4693 ;; (filter #(re-matches #".*.png$" (.getCanonicalPath %))694 ;; (file-seq695 ;; (file-str696 ;; "/home/r/media/anime/mao-temp/images"))))))))700 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;702 (defn proprioception703 "Create a proprioception map that reports the rotations of the704 various limbs of the creature's body"705 [creature]706 [#^Node creature]707 (let [708 nodes (node-seq creature)709 joints710 (map711 :joint712 (filter713 #(isa? (class %) JointControl)714 (reduce715 concat716 (map (fn [node]717 (map (fn [num] (.getControl node num))718 (range (.getNumControls node))))719 nodes))))]720 (fn []721 (reduce concat (map relative-positions (list (first joints)))))))724 (defn skel [node]725 (doto726 (.getSkeleton727 (.getControl node SkeletonControl))728 ;; this is necessary to force the skeleton to have accurate world729 ;; transforms before it is rendered to the screen.730 (.resetAndUpdate)))732 (defn green-x-ray []733 (doto (Material. (asset-manager)734 "Common/MatDefs/Misc/Unshaded.j3md")735 (.setColor "Color" ColorRGBA/Green)736 (-> (.getAdditionalRenderState)737 (.setDepthTest false))))739 (defn test-worm []740 (.start741 (world742 (doto (Node.)743 ;;(.attachChild (point-worm))744 (.attachChild (load-blender-model745 "Models/anim2/joint-worm.blend"))747 (.attachChild (box 10 1 10748 :position (Vector3f. 0 -2 0) :mass 0749 :color (ColorRGBA/Gray))))750 {751 "key-space" (fire-cannon-ball)752 }753 (fn [world]754 (enable-debug world)755 (light-up-everything world)756 ;;(.setTimer world (NanoTimer.))757 )758 no-op)))762 ;; defunct movement stuff763 (defn torque-controls [control]764 (let [torques765 (concat766 (map #(Vector3f. 0 (Math/sin %) (Math/cos %))767 (range 0 (* Math/PI 2) (/ (* Math/PI 2) 20)))768 [Vector3f/UNIT_X])]769 (map (fn [torque-axis]770 (fn [torque]771 (.applyTorque772 control773 (.mult (.mult (.getPhysicsRotation control)774 torque-axis)775 (float776 (* (.getMass control) torque))))))777 torques)))779 (defn motor-map780 "Take a creature and generate a function that will enable fine781 grained control over all the creature's limbs."782 [#^Node creature]783 (let [controls (keep #(.getControl % RigidBodyControl)784 (node-seq creature))785 limb-controls (reduce concat (map torque-controls controls))786 body-control (partial map #(%1 %2) limb-controls)]787 body-control))789 (defn test-motor-map790 "see how torque works."791 []792 (let [finger (box 3 0.5 0.5 :position (Vector3f. 0 2 0)793 :mass 1 :color ColorRGBA/Green)794 motor-map (motor-map finger)]795 (world796 (nodify [finger797 (box 10 0.5 10 :position (Vector3f. 0 -5 0) :mass 0798 :color ColorRGBA/Gray)])799 standard-debug-controls800 (fn [world]801 (set-gravity world Vector3f/ZERO)802 (light-up-everything world)803 (.setTimer world (NanoTimer.)))804 (fn [_ _]805 (dorun (motor-map [0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0]))))))806 #+end_src814 * COMMENT generate Source815 #+begin_src clojure :tangle ../src/cortex/body.clj816 <<proprioception>>817 <<motor-control>>818 #+end_src820 #+begin_src clojure :tangle ../src/cortex/test/body.clj821 <<test-body>>822 #+end_src