Mercurial > cortex
comparison 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 |
comparison
equal
deleted
inserted
replaced
205:d3a2abfac405 | 206:df46a609fed9 |
---|---|
146 | 146 |
147 | 147 |
148 | 148 |
149 #+end_src | 149 #+end_src |
150 | 150 |
151 #+name: test-body | |
152 #+begin_src clojure | |
153 | |
154 | |
155 (defn test-proprioception | |
156 "Testing proprioception: | |
157 You should see two foating bars, and a printout of pitch, yaw, and | |
158 roll. Pressing key-r/key-t should move the blue bar up and down and | |
159 change only the value of pitch. key-f/key-g moves it side to side | |
160 and changes yaw. key-v/key-b will spin the blue segment clockwise | |
161 and counterclockwise, and only affect roll." | |
162 [] | |
163 (let [hand (box 0.2 1 0.2 :position (Vector3f. 0 0 0) | |
164 :mass 0 :color ColorRGBA/Green :name "hand") | |
165 finger (box 0.2 1 0.2 :position (Vector3f. 0 2.4 0) | |
166 :mass 1 :color ColorRGBA/Red :name "finger") | |
167 joint-node (box 0.1 0.05 0.05 :color ColorRGBA/Yellow | |
168 :position (Vector3f. 0 1.2 0) | |
169 :rotation (doto (Quaternion.) | |
170 (.fromAngleAxis | |
171 (/ Math/PI 2) | |
172 (Vector3f. 0 0 1))) | |
173 :physical? false) | |
174 joint (join-at-point hand finger (Vector3f. 0 1.2 0 )) | |
175 creature (nodify [hand finger joint-node]) | |
176 finger-control (.getControl finger RigidBodyControl) | |
177 hand-control (.getControl hand RigidBodyControl)] | |
178 | |
179 | |
180 (let | |
181 ;; ******************************************* | |
182 | |
183 [floor (box 10 10 10 :position (Vector3f. 0 -15 0) | |
184 :mass 0 :color ColorRGBA/Gray) | |
185 | |
186 root (nodify [creature floor]) | |
187 prop (joint-proprioception creature joint-node) | |
188 prop-view (proprioception-debug-window) | |
189 | |
190 controls | |
191 (merge standard-debug-controls | |
192 {"key-o" | |
193 (fn [_ _] (.setEnabled finger-control true)) | |
194 "key-p" | |
195 (fn [_ _] (.setEnabled finger-control false)) | |
196 "key-k" | |
197 (fn [_ _] (.setEnabled hand-control true)) | |
198 "key-l" | |
199 (fn [_ _] (.setEnabled hand-control false)) | |
200 "key-i" | |
201 (fn [world _] (set-gravity world (Vector3f. 0 0 0))) | |
202 "key-period" | |
203 (fn [world _] | |
204 (.setEnabled finger-control false) | |
205 (.setEnabled hand-control false) | |
206 (.rotate creature (doto (Quaternion.) | |
207 (.fromAngleAxis | |
208 (float (/ Math/PI 15)) | |
209 (Vector3f. 0 0 -1)))) | |
210 | |
211 (.setEnabled finger-control true) | |
212 (.setEnabled hand-control true) | |
213 (set-gravity world (Vector3f. 0 0 0)) | |
214 ) | |
215 | |
216 | |
217 } | |
218 ) | |
219 | |
220 ] | |
221 (comment | |
222 (.setCollisionGroup | |
223 (.getControl hand RigidBodyControl) | |
224 PhysicsCollisionObject/COLLISION_GROUP_NONE) | |
225 ) | |
226 (apply | |
227 world | |
228 (with-movement | |
229 hand | |
230 ["key-y" "key-u" "key-h" "key-j" "key-n" "key-m"] | |
231 [10 10 10 10 1 1] | |
232 (with-movement | |
233 finger | |
234 ["key-r" "key-t" "key-f" "key-g" "key-v" "key-b"] | |
235 [1 1 10 10 10 10] | |
236 [root | |
237 controls | |
238 (fn [world] | |
239 (.setTimer world (com.aurellem.capture.RatchetTimer. 60)) | |
240 (set-gravity world (Vector3f. 0 0 0)) | |
241 (light-up-everything world)) | |
242 (fn [_ _] (prop-view (list (prop))))])))))) | |
243 | |
244 #+end_src | |
245 | |
246 | |
151 * COMMENT generate source | 247 * COMMENT generate source |
152 #+begin_src clojure :tangle ../src/cortex/proprioception.clj | 248 #+begin_src clojure :tangle ../src/cortex/proprioception.clj |
153 <<proprioception>> | 249 <<proprioception>> |
154 #+end_src | 250 #+end_src |