# HG changeset patch # User Robert McIntyre # Date 1329065825 25200 # Node ID 3c9724c8d86b1ff3eacc26703702fddd802300a4 # Parent be78d7bd6920fa73c2de4107a6a934f7443d05af enabled optional recording in vision tests diff -r be78d7bd6920 -r 3c9724c8d86b org/vision.org --- a/org/vision.org Sun Feb 12 09:56:38 2012 -0700 +++ b/org/vision.org Sun Feb 12 09:57:05 2012 -0700 @@ -449,7 +449,6 @@ #+end_src * Tests - ** Basic Test This is a basic test for the vision system. It only tests the @@ -558,7 +557,7 @@ (comp #(change-color % color) (fire-cannon-ball))) -(defn test-worm-vision [] +(defn test-worm-vision [record] (let [the-worm (doto (worm)(body!)) vision (vision! the-worm) vision-display (view-vision) @@ -586,6 +585,12 @@ (.setTimer world timer) (display-dialated-time world timer) ;; add a view from the worm's perspective + (if record + (Capture/captureVideo + world + (File. + "/home/r/proj/cortex/render/worm-vision/main-view"))) + (add-camera! world (add-eye! the-worm @@ -593,19 +598,18 @@ (.getChild the-worm "eyes") "eye")) (comp (view-image - (File. "/home/r/proj/cortex/render/worm-vision/worm-view")) + (if record + (File. + "/home/r/proj/cortex/render/worm-vision/worm-view"))) BufferedImage!)) - (set-gravity world Vector3f/ZERO) - (try - (Capture/captureVideo - world - (File. "/home/r/proj/cortex/render/worm-vision/main-view")))) + + (set-gravity world Vector3f/ZERO)) (fn [world _ ] (.setLocalTranslation me (.getLocation (.getCamera world))) (vision-display (map #(% world) vision) - (File. "/home/r/proj/cortex/render/worm-vision")) + (if record (File. "/home/r/proj/cortex/render/worm-vision"))) (fix-display world))))) #+end_src @@ -678,7 +682,7 @@ cd /home/r/proj/cortex/render/worm-vision ffmpeg -r 25 -b 9001k -i out/%07d.png -vcodec libtheora worm-vision.ogg #+end_src - + * Headers #+name: vision-header