diff org/proprioception.org @ 206:df46a609fed9

removed dead code
author Robert McIntyre <rlm@mit.edu>
date Thu, 09 Feb 2012 04:21:12 -0700
parents 2902aca33c6e
children 5d7961d7fded
line wrap: on
line diff
     1.1 --- a/org/proprioception.org	Thu Feb 09 04:15:09 2012 -0700
     1.2 +++ b/org/proprioception.org	Thu Feb 09 04:21:12 2012 -0700
     1.3 @@ -148,6 +148,102 @@
     1.4  
     1.5  #+end_src
     1.6  
     1.7 +#+name: test-body
     1.8 +#+begin_src clojure
     1.9 +
    1.10 +
    1.11 +(defn test-proprioception
    1.12 +  "Testing proprioception:
    1.13 +   You should see two foating bars, and a printout of pitch, yaw, and
    1.14 +   roll. Pressing key-r/key-t should move the blue bar up and down and
    1.15 +   change only the value of pitch. key-f/key-g moves it side to side
    1.16 +   and changes yaw. key-v/key-b will spin the blue segment clockwise
    1.17 +   and counterclockwise, and only affect roll."
    1.18 +  []
    1.19 +  (let [hand    (box 0.2 1 0.2 :position (Vector3f. 0 0 0)
    1.20 +                     :mass 0 :color ColorRGBA/Green :name "hand")
    1.21 +        finger (box 0.2 1 0.2 :position (Vector3f. 0 2.4 0)
    1.22 +                    :mass 1 :color ColorRGBA/Red :name "finger")
    1.23 +        joint-node (box 0.1 0.05 0.05 :color ColorRGBA/Yellow
    1.24 +                        :position (Vector3f. 0 1.2 0)
    1.25 +                        :rotation (doto (Quaternion.)
    1.26 +                                    (.fromAngleAxis
    1.27 +                                     (/ Math/PI 2)
    1.28 +                                     (Vector3f. 0 0 1)))
    1.29 +                        :physical? false)
    1.30 +        joint (join-at-point hand finger (Vector3f. 0 1.2 0 ))
    1.31 +        creature (nodify [hand finger joint-node])
    1.32 +        finger-control (.getControl finger RigidBodyControl)
    1.33 +        hand-control (.getControl hand RigidBodyControl)]
    1.34 +    
    1.35 +
    1.36 +    (let
    1.37 +        ;; *******************************************
    1.38 +                
    1.39 +        [floor   (box 10 10 10 :position (Vector3f. 0 -15 0)
    1.40 +                     :mass 0 :color ColorRGBA/Gray)
    1.41 +        
    1.42 +        root (nodify [creature floor])
    1.43 +        prop (joint-proprioception creature joint-node)
    1.44 +        prop-view (proprioception-debug-window)
    1.45 +        
    1.46 +        controls
    1.47 +        (merge standard-debug-controls
    1.48 +               {"key-o"
    1.49 +                (fn [_ _] (.setEnabled finger-control true))
    1.50 +                "key-p"
    1.51 +                (fn [_ _] (.setEnabled finger-control false))
    1.52 +                "key-k"
    1.53 +                (fn [_ _] (.setEnabled hand-control true))
    1.54 +                "key-l"
    1.55 +                (fn [_ _] (.setEnabled hand-control false))
    1.56 +                "key-i"
    1.57 +                (fn [world _] (set-gravity world (Vector3f. 0 0 0)))
    1.58 +                "key-period"
    1.59 +                (fn [world _]
    1.60 +                  (.setEnabled finger-control false)
    1.61 +                  (.setEnabled hand-control false)
    1.62 +                  (.rotate creature (doto (Quaternion.)
    1.63 +                                      (.fromAngleAxis
    1.64 +                                       (float (/ Math/PI 15))
    1.65 +                                       (Vector3f. 0 0 -1))))
    1.66 +                                              
    1.67 +                  (.setEnabled finger-control true)
    1.68 +                  (.setEnabled hand-control true)
    1.69 +                  (set-gravity world (Vector3f. 0 0 0))
    1.70 +                  )
    1.71 +                
    1.72 +                  
    1.73 +                }
    1.74 +               )
    1.75 +
    1.76 +        ]
    1.77 +    (comment
    1.78 +      (.setCollisionGroup
    1.79 +       (.getControl hand RigidBodyControl)
    1.80 +       PhysicsCollisionObject/COLLISION_GROUP_NONE)
    1.81 +      )
    1.82 +    (apply
    1.83 +     world
    1.84 +     (with-movement
    1.85 +       hand
    1.86 +       ["key-y" "key-u" "key-h" "key-j" "key-n" "key-m"]
    1.87 +       [10 10 10 10 1 1]
    1.88 +       (with-movement
    1.89 +         finger
    1.90 +         ["key-r" "key-t" "key-f" "key-g" "key-v" "key-b"]
    1.91 +         [1 1 10 10 10 10]
    1.92 +         [root
    1.93 +          controls
    1.94 +          (fn [world]
    1.95 +            (.setTimer world (com.aurellem.capture.RatchetTimer. 60))
    1.96 +            (set-gravity world (Vector3f. 0 0 0))
    1.97 +            (light-up-everything world))
    1.98 +          (fn [_ _] (prop-view (list (prop))))]))))))
    1.99 +
   1.100 +#+end_src
   1.101 +
   1.102 +
   1.103  * COMMENT generate source
   1.104  #+begin_src clojure :tangle ../src/cortex/proprioception.clj
   1.105  <<proprioception>>