Mercurial > cortex
changeset 236:3c9724c8d86b
enabled optional recording in vision tests
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 12 Feb 2012 09:57:05 -0700 |
parents | be78d7bd6920 |
children | 02b2e6f3fb43 |
files | org/vision.org |
diffstat | 1 files changed, 14 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/org/vision.org Sun Feb 12 09:56:38 2012 -0700 1.2 +++ b/org/vision.org Sun Feb 12 09:57:05 2012 -0700 1.3 @@ -449,7 +449,6 @@ 1.4 #+end_src 1.5 1.6 * Tests 1.7 - 1.8 ** Basic Test 1.9 1.10 This is a basic test for the vision system. It only tests the 1.11 @@ -558,7 +557,7 @@ 1.12 (comp #(change-color % color) 1.13 (fire-cannon-ball))) 1.14 1.15 -(defn test-worm-vision [] 1.16 +(defn test-worm-vision [record] 1.17 (let [the-worm (doto (worm)(body!)) 1.18 vision (vision! the-worm) 1.19 vision-display (view-vision) 1.20 @@ -586,6 +585,12 @@ 1.21 (.setTimer world timer) 1.22 (display-dialated-time world timer) 1.23 ;; add a view from the worm's perspective 1.24 + (if record 1.25 + (Capture/captureVideo 1.26 + world 1.27 + (File. 1.28 + "/home/r/proj/cortex/render/worm-vision/main-view"))) 1.29 + 1.30 (add-camera! 1.31 world 1.32 (add-eye! the-worm 1.33 @@ -593,19 +598,18 @@ 1.34 (.getChild the-worm "eyes") "eye")) 1.35 (comp 1.36 (view-image 1.37 - (File. "/home/r/proj/cortex/render/worm-vision/worm-view")) 1.38 + (if record 1.39 + (File. 1.40 + "/home/r/proj/cortex/render/worm-vision/worm-view"))) 1.41 BufferedImage!)) 1.42 - (set-gravity world Vector3f/ZERO) 1.43 - (try 1.44 - (Capture/captureVideo 1.45 - world 1.46 - (File. "/home/r/proj/cortex/render/worm-vision/main-view")))) 1.47 + 1.48 + (set-gravity world Vector3f/ZERO)) 1.49 1.50 (fn [world _ ] 1.51 (.setLocalTranslation me (.getLocation (.getCamera world))) 1.52 (vision-display 1.53 (map #(% world) vision) 1.54 - (File. "/home/r/proj/cortex/render/worm-vision")) 1.55 + (if record (File. "/home/r/proj/cortex/render/worm-vision"))) 1.56 (fix-display world))))) 1.57 #+end_src 1.58 1.59 @@ -678,7 +682,7 @@ 1.60 cd /home/r/proj/cortex/render/worm-vision 1.61 ffmpeg -r 25 -b 9001k -i out/%07d.png -vcodec libtheora worm-vision.ogg 1.62 #+end_src 1.63 - 1.64 + 1.65 * Headers 1.66 1.67 #+name: vision-header