Mercurial > cortex
diff org/proprioception.org @ 257:5d7961d7fded
wrote intro text for proprioception
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 14 Feb 2012 00:37:42 -0700 |
parents | df46a609fed9 |
children | f4b67005b702 |
line wrap: on
line diff
1.1 --- a/org/proprioception.org Mon Feb 13 23:45:38 2012 -0700 1.2 +++ b/org/proprioception.org Tue Feb 14 00:37:42 2012 -0700 1.3 @@ -6,23 +6,46 @@ 1.4 #+SETUPFILE: ../../aurellem/org/setup.org 1.5 #+INCLUDE: ../../aurellem/org/level-0.org 1.6 1.7 -#+name: proprioception 1.8 +* Proprioception 1.9 + 1.10 +Close your eyes, and touch your nose with your right index finger. How 1.11 +did you do it? You could not see your hand, and neither your hand nor 1.12 +your nose could use the sense of touch to guide the path of your hand. 1.13 +There are no sound cues, and Taste and Smell certainly don't provide 1.14 +any help. You know where your hand is without your other senses 1.15 +because of Proprioception. 1.16 + 1.17 +Humans can sometimes loose this sense through viral infections or 1.18 +damage to the spinal cord or brain, and when they do, they loose the 1.19 +ability to control their own bodies without looking directly at the 1.20 +parts they want to move. In [[http://en.wikipedia.org/wiki/The_Man_Who_Mistook_His_Wife_for_a_Hat][The Man Who Mistook His Wife for a Hat]], 1.21 +a woman named Christina looses this sense and has to learn how to move 1.22 +by carefully watching her arms and legs. She describes proprioception 1.23 +as the "eyes of the body, the way the body sees itself". 1.24 + 1.25 +Proprioception in humans is mediated by [[http://en.wikipedia.org/wiki/Articular_capsule][joint capsules]], [[http://en.wikipedia.org/wiki/Muscle_spindle][muscle 1.26 +spindles]], and the [[http://en.wikipedia.org/wiki/Golgi_tendon_organ][Golgi tendon organs]]. These measure the relative 1.27 +positions of each pody part by monitoring muscle strain and length. 1.28 + 1.29 +It's clear that this is a vital sense for fulid, graceful 1.30 +movement. It's also particurally easy to implement in jMonkeyEngine. 1.31 + 1.32 +My simulated proprioception calculates the relative angles of each 1.33 +joint from the rest position defined in the blender file. This 1.34 +simulates the muscle-spindles and joint capsules. I will deal with 1.35 +Golgi tendon organs, which calculate muscle strain, in the [[./movement.org][next post]]. 1.36 + 1.37 +* Helper Functions 1.38 + 1.39 + 1.40 +#+name: helpers 1.41 #+begin_src clojure 1.42 -(ns cortex.proprioception 1.43 - "Simulate the sense of proprioception (ability to detect the 1.44 - relative positions of body parts with repsect to other body parts) 1.45 - in jMonkeyEngine3. Reads specially prepared blender files to 1.46 - automatically generate proprioceptive senses." 1.47 - (:use (cortex world util sense body)) 1.48 - (:use clojure.contrib.def) 1.49 - (:import com.jme3.scene.Node) 1.50 - (:import java.awt.image.BufferedImage) 1.51 - (:import (com.jme3.math Vector3f Quaternion))) 1.52 +(in-ns 'cortex.proprioception) 1.53 1.54 (defn right-handed? 1.55 "true iff the three vectors form a right handed coordinate 1.56 - system. The three vectors do not have to be normalized or 1.57 - orthogonal." 1.58 + system. The three vectors do not have to be normalized or 1.59 + orthogonal." 1.60 [vec1 vec2 vec3] 1.61 (< 0 (.dot (.cross vec1 vec2) vec3))) 1.62 1.63 @@ -34,8 +57,11 @@ 1.64 (let [angle (.angleBetween vec1 vec2)] 1.65 (if (right-handed? vec1 vec2 axis) 1.66 angle (- (* 2 Math/PI) angle)))) 1.67 +#+end_src 1.68 1.69 -(defn proprioception-fn 1.70 +#+name: proprioception 1.71 +#+begin_src clojure 1.72 +(defn proprioception-kernel 1.73 "Returns a function which returns proprioceptive sensory data when 1.74 called inside a running simulation." 1.75 [#^Node parts #^Node joint] 1.76 @@ -80,18 +106,21 @@ 1.77 that joint." 1.78 [#^Node creature] 1.79 ;; extract the body's joints 1.80 - (let [senses (map (partial proprioception-fn creature) 1.81 + (let [senses (map (partial proprioception-kernel creature) 1.82 (joints creature))] 1.83 (fn [] 1.84 (map #(%) senses)))) 1.85 +#+end_src 1.86 1.87 +#+name: visualize 1.88 +#+begin_src clojure 1.89 +(in-ns 'cortex.proprioception) 1.90 1.91 (defn draw-sprite [image sprite x y color ] 1.92 (dorun 1.93 (for [[u v] sprite] 1.94 (.setRGB image (+ u x) (+ v y) color)))) 1.95 1.96 - 1.97 (defn view-angle 1.98 "create a debug view of an angle" 1.99 [color] 1.100 @@ -143,15 +172,24 @@ 1.101 display each element of the list to the screen as an image." 1.102 [] 1.103 (view-sense proprioception-display-kernel)) 1.104 - 1.105 - 1.106 +#+end_src 1.107 1.108 +#+name: proprioception-header 1.109 +#+begin_src clojure 1.110 +(ns cortex.proprioception 1.111 + "Simulate the sense of proprioception (ability to detect the 1.112 + relative positions of body parts with repsect to other body parts) 1.113 + in jMonkeyEngine3. Reads specially prepared blender files to 1.114 + automatically generate proprioceptive senses." 1.115 + (:use (cortex world util sense body)) 1.116 + (:use clojure.contrib.def) 1.117 + (:import com.jme3.scene.Node) 1.118 + (:import java.awt.image.BufferedImage) 1.119 + (:import (com.jme3.math Vector3f Quaternion))) 1.120 #+end_src 1.121 1.122 #+name: test-body 1.123 #+begin_src clojure 1.124 - 1.125 - 1.126 (defn test-proprioception 1.127 "Testing proprioception: 1.128 You should see two foating bars, and a printout of pitch, yaw, and 1.129 @@ -246,5 +284,8 @@ 1.130 1.131 * COMMENT generate source 1.132 #+begin_src clojure :tangle ../src/cortex/proprioception.clj 1.133 +<<proprioception-header>> 1.134 +<<helpers>> 1.135 <<proprioception>> 1.136 +<<visualize>> 1.137 #+end_src