Mercurial > cortex
changeset 340:4f5a5d5f1613
added time dialation display for test suite.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Jul 2012 11:18:47 -0500 |
parents | 0efa36180e8a |
children | 2e7d786241d3 |
files | org/body.org org/hearing.org org/movement.org org/proprioception.org org/touch.org org/vision.org |
diffstat | 6 files changed, 97 insertions(+), 94 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/org/body.org Sat Jul 21 10:03:02 2012 -0500 1.2 +++ b/org/body.org Sat Jul 21 11:18:47 2012 -0500 1.3 @@ -579,11 +579,14 @@ 1.4 (ns cortex.test.body 1.5 (:use (cortex world util body)) 1.6 (:import 1.7 - (com.aurellem.capture Capture RatchetTimer) 1.8 + (com.aurellem.capture Capture RatchetTimer IsoTimer) 1.9 (com.jme3.math Quaternion Vector3f ColorRGBA) 1.10 java.io.File)) 1.11 #+end_src 1.12 1.13 +#+results: test-header 1.14 +: java.io.File 1.15 + 1.16 * Source 1.17 - [[../src/cortex/body.clj][cortex.body]] 1.18 - [[../src/cortex/test/body.clj][cortex.test.body]]
2.1 --- a/org/hearing.org Sat Jul 21 10:03:02 2012 -0500 2.2 +++ b/org/hearing.org Sat Jul 21 11:18:47 2012 -0500 2.3 @@ -1027,8 +1027,8 @@ 2.4 hearing. When you play a sound, the bar should display a waveform. 2.5 2.6 Keys: 2.7 - <enter> : play sound" 2.8 - 2.9 + <enter> : play sound 2.10 + l : play hymn" 2.11 ([] (test-worm-hearing false)) 2.12 ([record?] 2.13 (let [the-worm (doto (worm) (body!)) 2.14 @@ -1051,14 +1051,17 @@ 2.15 (if value (.play hymn)))}) 2.16 (fn [world] 2.17 (light-up-everything world) 2.18 + (let [timer (IsoTimer. 60)] 2.19 + (.setTimer world timer) 2.20 + (display-dilated-time world timer)) 2.21 (if record? 2.22 (do 2.23 (com.aurellem.capture.Capture/captureVideo 2.24 world 2.25 - (File."/home/r/proj/cortex/render/worm-audio/frames")) 2.26 + (File. "/home/r/proj/cortex/render/worm-audio/frames")) 2.27 (com.aurellem.capture.Capture/captureAudio 2.28 world 2.29 - (File."/home/r/proj/cortex/render/worm-audio/audio.wav"))))) 2.30 + (File. "/home/r/proj/cortex/render/worm-audio/audio.wav"))))) 2.31 2.32 (fn [world tpf] 2.33 (hearing-display 2.34 @@ -1067,6 +1070,9 @@ 2.35 (File. "/home/r/proj/cortex/render/worm-audio/hearing-data")))))))) 2.36 #+end_src 2.37 2.38 +#+results: test-hearing-2 2.39 +: #'cortex.test.hearing/test-worm-hearing 2.40 + 2.41 In this test, I load the worm with its newly formed ear and let it 2.42 hear sounds. The sound the worm is hearing is localized to the origin 2.43 of the world, and you can see that as the worm moves farther away from 2.44 @@ -1170,9 +1176,13 @@ 2.45 (:import java.io.File) 2.46 (:import com.jme3.scene.Node 2.47 com.jme3.system.AppSettings 2.48 - com.jme3.math.Vector3f)) 2.49 + com.jme3.math.Vector3f) 2.50 + (:import (com.aurellem.capture Capture IsoTimer RatchetTimer))) 2.51 #+end_src 2.52 2.53 +#+results: test-header 2.54 +: com.aurellem.capture.RatchetTimer 2.55 + 2.56 * Source Listing 2.57 - [[../src/cortex/hearing.clj][cortex.hearing]] 2.58 - [[../src/cortex/test/hearing.clj][cortex.test.hearing]]
3.1 --- a/org/movement.org Sat Jul 21 10:03:02 2012 -0500 3.2 +++ b/org/movement.org Sat Jul 21 11:18:47 2012 -0500 3.3 @@ -185,6 +185,8 @@ 3.4 3.5 #+name: test-movement 3.6 #+begin_src clojure 3.7 +(in-ns 'cortex.test.movement) 3.8 + 3.9 (defn test-worm-movement 3.10 "Testing movement: 3.11 You should see the worm suspended in mid air and a display on the 3.12 @@ -217,13 +219,16 @@ 3.13 (if value 3.14 (swap! muscle-exertion (fn [v] (- v 20)))))}) 3.15 (fn [world] 3.16 + 3.17 + (let [timer (RatchetTimer. 60)] 3.18 + (.setTimer world timer) 3.19 + (display-dilated-time world timer)) 3.20 (if record? 3.21 (Capture/captureVideo 3.22 world 3.23 (File. "/home/r/proj/cortex/render/worm-muscles/main-view"))) 3.24 (light-up-everything world) 3.25 (enable-debug world) 3.26 - (.setTimer world (RatchetTimer. 60)) 3.27 (set-gravity world (Vector3f. 0 0 0)) 3.28 (.setLocation (.getCamera world) 3.29 (Vector3f. -4.912815, 2.004171, 0.15710819)) 3.30 @@ -237,6 +242,9 @@ 3.31 (File. "/home/r/proj/cortex/render/worm-muscles/muscles")))))))) 3.32 #+end_src 3.33 3.34 +#+results: test-movement 3.35 +: #'cortex.test.movement/test-worm-movement 3.36 + 3.37 * Video Demonstration 3.38 3.39 #+begin_html
4.1 --- a/org/proprioception.org Sat Jul 21 10:03:02 2012 -0500 4.2 +++ b/org/proprioception.org Sat Jul 21 11:18:47 2012 -0500 4.3 @@ -272,11 +272,13 @@ 4.4 [root 4.5 standard-debug-controls 4.6 (fn [world] 4.7 + (let [timer (RatchetTimer. 60)] 4.8 + (.setTimer world timer) 4.9 + (display-dilated-time world timer)) 4.10 (if record? 4.11 (Capture/captureVideo 4.12 world 4.13 (File. "/home/r/proj/cortex/render/proprio/main-view"))) 4.14 - (.setTimer world (com.aurellem.capture.RatchetTimer. 60)) 4.15 (set-gravity world (Vector3f. 0 0 0)) 4.16 (enable-debug world) 4.17 (light-up-everything world)) 4.18 @@ -363,7 +365,7 @@ 4.19 #+name: test-proprioception-header 4.20 #+begin_src clojure 4.21 (ns cortex.test.proprioception 4.22 - (:import (com.aurellem.capture Capture RatchetTimer)) 4.23 + (:import (com.aurellem.capture Capture RatchetTimer IsoTimer)) 4.24 (:use (cortex util world proprioception body)) 4.25 (:import java.io.File) 4.26 (:import com.jme3.bullet.control.RigidBodyControl) 4.27 @@ -371,6 +373,9 @@ 4.28 (:import (com.jme3.math Vector3f Quaternion ColorRGBA))) 4.29 #+end_src 4.30 4.31 +#+results: test-proprioception-header 4.32 +: com.jme3.math.ColorRGBA 4.33 + 4.34 * Source Listing 4.35 - [[../src/cortex/proprioception.clj][cortex.proprioception]] 4.36 - [[../src/cortex/test/touch.clj][cortex.test.proprioception]]
5.1 --- a/org/touch.org Sat Jul 21 10:03:02 2012 -0500 5.2 +++ b/org/touch.org Sat Jul 21 11:18:47 2012 -0500 5.3 @@ -552,6 +552,9 @@ 5.4 standard-debug-controls 5.5 5.6 (fn [world] 5.7 + (let [timer (IsoTimer. 60)] 5.8 + (.setTimer world timer) 5.9 + (display-dilated-time world timer)) 5.10 (if record? 5.11 (Capture/captureVideo 5.12 world 5.13 @@ -566,6 +569,9 @@ 5.14 (File. "/home/r/proj/cortex/render/touch-cube/touch/")))))))) 5.15 #+end_src 5.16 5.17 +#+results: test-touch-1 5.18 +: #'cortex.test.touch/test-basic-touch 5.19 + 5.20 ** Basic Touch Demonstration 5.21 5.22 #+begin_html 5.23 @@ -656,6 +662,9 @@ 5.24 standard-debug-controls 5.25 5.26 (fn [world] 5.27 + (let [timer (IsoTimer. 60)] 5.28 + (.setTimer world timer) 5.29 + (display-dilated-time world timer)) 5.30 (if record? 5.31 (Capture/captureVideo 5.32 world 5.33 @@ -670,6 +679,9 @@ 5.34 (File. "/home/r/proj/cortex/render/worm-touch/touch/")))))))) 5.35 #+end_src 5.36 5.37 +#+results: test-touch-2 5.38 +: #'cortex.test.touch/test-worm-touch 5.39 + 5.40 ** Worm Touch Demonstration 5.41 #+begin_html 5.42 <div class="figure"> 5.43 @@ -747,11 +759,14 @@ 5.44 (ns cortex.test.touch 5.45 (:use (cortex world util sense body touch)) 5.46 (:use cortex.test.body) 5.47 - (:import com.aurellem.capture.Capture) 5.48 + (:import (com.aurellem.capture Capture IsoTimer)) 5.49 (:import java.io.File) 5.50 (:import (com.jme3.math Vector3f ColorRGBA))) 5.51 #+end_src 5.52 5.53 +#+results: test-touch-header 5.54 +: com.jme3.math.ColorRGBA 5.55 + 5.56 * Source Listing 5.57 - [[../src/cortex/touch.clj][cortex.touch]] 5.58 - [[../src/cortex/test/touch.clj][cortex.test.touch]]
6.1 --- a/org/vision.org Sat Jul 21 10:03:02 2012 -0500 6.2 +++ b/org/vision.org Sat Jul 21 11:18:47 2012 -0500 6.3 @@ -492,13 +492,19 @@ 6.4 (if record? 6.5 (File. "/home/r/proj/cortex/render/vision/2"))) 6.6 BufferedImage!)) 6.7 + (let [timer (RatchetTimer. 60)] 6.8 + (.setTimer world timer) 6.9 + (display-dilated-time world timer)) 6.10 ;; This is here to restore the main view 6.11 - ;; after the other views have completed processing 6.12 + ;; after the other views have completed processing 6.13 (add-camera! world (.getCamera world) no-op))) 6.14 (fn [world tpf] 6.15 (.rotate candy (* tpf 0.2) 0 0)))))) 6.16 #+end_src 6.17 6.18 +#+results: test-1 6.19 +: #'cortex.test.vision/test-pipeline 6.20 + 6.21 #+begin_html 6.22 <div class="figure"> 6.23 <video controls="controls" width="755"> 6.24 @@ -599,10 +605,9 @@ 6.25 ([] (test-worm-vision false)) 6.26 ([record?] 6.27 (let [the-worm (doto (worm)(body!)) 6.28 - ;;the-worm (gen-worm) 6.29 - ;;vision (vision! the-worm) 6.30 - ;;vision-display (view-vision) 6.31 - ;;fix-display (gen-fix-display) 6.32 + vision (vision! the-worm) 6.33 + vision-display (view-vision) 6.34 + fix-display (gen-fix-display) 6.35 me (sphere 0.5 :color ColorRGBA/Blue :physical? false) 6.36 x-axis 6.37 (box 1 0.01 0.01 :physical? false :color ColorRGBA/Red 6.38 @@ -613,92 +618,49 @@ 6.39 z-axis 6.40 (box 0.01 0.01 1 :physical? false :color ColorRGBA/Blue 6.41 :position (Vector3f. 0 -5 0)) 6.42 - timer (RatchetTimer. 60) 6.43 + 6.44 ] 6.45 6.46 (world 6.47 (nodify [(floor) the-worm x-axis y-axis z-axis me]) 6.48 - standard-debug-controls 6.49 - ;;"key-r" (colored-cannon-ball ColorRGBA/Red) 6.50 - ;;"key-b" (colored-cannon-ball ColorRGBA/Blue) 6.51 - ;;"key-g" (colored-cannon-ball ColorRGBA/Green)) 6.52 + (merge standard-debug-controls 6.53 + {"key-r" (colored-cannon-ball ColorRGBA/Red) 6.54 + "key-b" (colored-cannon-ball ColorRGBA/Blue) 6.55 + "key-g" (colored-cannon-ball ColorRGBA/Green)}) 6.56 6.57 (fn [world] 6.58 - (let 6.59 - [eye-pos (Vector3f. 0 30 0) 6.60 - cam (doto 6.61 - (.clone (.getCamera world)) 6.62 - (.setLocation eye-pos) 6.63 - (.lookAt Vector3f/ZERO 6.64 - Vector3f/UNIT_X)) 6.65 - 6.66 - bad-cam (doto 6.67 - ;;saved-cam 6.68 - ;;(.clone (.getCamera world)) 6.69 - 6.70 - (com.jme3.renderer.Camera. 640 480) 6.71 - (.setFrustumPerspective 6.72 - (float 45) 6.73 - (float (/ 640 480)) 6.74 - (float 1) 6.75 - (float 1000)) 6.76 - 6.77 - (.setLocation eye-pos) 6.78 - (.lookAt Vector3f/ZERO 6.79 - Vector3f/UNIT_X)) 6.80 - 6.81 - bad-cam (add-eye! the-worm (first (eyes the-worm))) 6.82 - ] 6.83 - 6.84 - 6.85 - (light-up-everything world) 6.86 - ;;(speed-up world) 6.87 - (.setTimer world timer) 6.88 - ;;(display-dilated-time world timer) 6.89 - ;; add a view from the worm's perspective 6.90 + (light-up-everything world) 6.91 + (speed-up world) 6.92 + (let [timer (RatchetTimer. 60)] 6.93 + (.setTimer world timer) 6.94 + (display-dilated-time world timer)) 6.95 + ;; add a view from the worm's perspective 6.96 + (if record? 6.97 + (Capture/captureVideo 6.98 + world 6.99 + (File. 6.100 + "/home/r/proj/cortex/render/worm-vision/main-view"))) 6.101 + 6.102 + (add-camera! 6.103 + world 6.104 + (add-eye! the-worm (first (eyes the-worm))) 6.105 + (comp 6.106 + (view-image 6.107 + (if record? 6.108 + (File. 6.109 + "/home/r/proj/cortex/render/worm-vision/worm-view"))) 6.110 + BufferedImage!)) 6.111 + 6.112 + (set-gravity world Vector3f/ZERO) 6.113 + (add-camera! world (.getCamera world) no-op)) 6.114 + 6.115 + (fn [world _] 6.116 + (.setLocalTranslation me (.getLocation (.getCamera world))) 6.117 + (vision-display 6.118 + (map #(% world) vision) 6.119 (if record? 6.120 - (Capture/captureVideo 6.121 - world 6.122 - (File. 6.123 - "/home/r/proj/cortex/render/worm-vision/main-view"))) 6.124 - 6.125 - (bind-sense (last (node-seq the-worm)) cam) 6.126 - (bind-sense (last (node-seq the-worm)) bad-cam) 6.127 - 6.128 - (add-camera! 6.129 - world 6.130 - bad-cam 6.131 - (comp 6.132 - (view-image 6.133 - (if record? 6.134 - (File. 6.135 - "/home/r/proj/cortex/render/worm-vision/worm-view"))) 6.136 - BufferedImage!)) 6.137 - 6.138 - 6.139 - 6.140 - (add-camera! 6.141 - world cam 6.142 - (comp 6.143 - (view-image 6.144 - (if record? 6.145 - (File. 6.146 - "/home/r/proj/cortex/render/worm-vision/worm-view"))) 6.147 - BufferedImage!)) 6.148 - (set-gravity world Vector3f/ZERO) 6.149 - (add-camera! world (.getCamera world) no-op) 6.150 - 6.151 - (println-repl cam "\n" bad-cam) 6.152 - 6.153 - )) 6.154 - 6.155 - (fn [world _ ] 6.156 - (.setLocalTranslation me (.getLocation (.getCamera world))) 6.157 - ;; (vision-display 6.158 - ;; (map #(% world) vision) 6.159 - ;; (if record? 6.160 - ;; (File. "/home/r/proj/cortex/render/worm-vision"))) 6.161 - ;;(fix-display world) 6.162 + (File. "/home/r/proj/cortex/render/worm-vision"))) 6.163 + (fix-display world) 6.164 ))))) 6.165 #+end_src 6.166