changeset 281:7351c9c0c471

resurrected integration test.
author Robert McIntyre <rlm@mit.edu>
date Wed, 15 Feb 2012 11:13:12 -0700
parents 301e91a6c2d1
children 2ad29b68ff22
files assets/Models/test-creature/hand.blend assets/Models/test-creature/palm-retina.png org/capture-video.org org/integration.org
diffstat 4 files changed, 28 insertions(+), 92 deletions(-) [+]
line wrap: on
line diff
     1.1 Binary file assets/Models/test-creature/hand.blend has changed
     2.1 Binary file assets/Models/test-creature/palm-retina.png has changed
     3.1 --- a/org/capture-video.org	Wed Feb 15 10:31:51 2012 -0700
     3.2 +++ b/org/capture-video.org	Wed Feb 15 11:13:12 2012 -0700
     3.3 @@ -757,31 +757,3 @@
     3.4   videoscale ! ffmpegcolorspace ! \
     3.5   video/x-raw-yuv, width=640, height=480, framerate=25/1 ! \
     3.6   videobox right=-640 ! mix.
     3.7 -
     3.8 -
     3.9 -
    3.10 -
    3.11 -
    3.12 -
    3.13 -
    3.14 -
    3.15 -
    3.16 -
    3.17 -
    3.18 -
    3.19 -
    3.20 -
    3.21 -
    3.22 -
    3.23 -
    3.24 -
    3.25 -
    3.26 -
    3.27 -
    3.28 -
    3.29 -
    3.30 -
    3.31 -
    3.32 -
    3.33 -
    3.34 -
     4.1 --- a/org/integration.org	Wed Feb 15 10:31:51 2012 -0700
     4.2 +++ b/org/integration.org	Wed Feb 15 11:13:12 2012 -0700
     4.3 @@ -1,4 +1,4 @@
     4.4 -#+title: First attempt at a creature!
     4.5 +#+title: 
     4.6  #+author: Robert McIntyre
     4.7  #+email: rlm@mit.edu
     4.8  #+description: 
     4.9 @@ -6,72 +6,44 @@
    4.10  #+SETUPFILE: ../../aurellem/org/setup.org
    4.11  #+INCLUDE: ../../aurellem/org/level-0.org
    4.12  
    4.13 +* Intro 
    4.14  
    4.15 -
    4.16 -
    4.17 -* Intro 
    4.18 -So far, I've made the following senses -- 
    4.19 - - Vision
    4.20 - - Hearing
    4.21 - - Touch
    4.22 - - Proprioception
    4.23 -
    4.24 -And one effector: 
    4.25 - - Movement
    4.26 -
    4.27 -However, the code so far has only enabled these senses, but has not
    4.28 -actually implemented them.  For example, there is still a lot of work
    4.29 -to be done for vision. I need to be able to create an /eyeball/ in
    4.30 -simulation that can be moved around and see the world from different
    4.31 -angles. I also need to determine weather to use log-polar or cartesian
    4.32 -for the visual input, and I need to determine how/wether to
    4.33 -disceritise the visual input.
    4.34 -
    4.35 -I also want to be able to visualize both the sensors and the
    4.36 -effectors in pretty pictures. This semi-retarted creature will be my
    4.37 -first attempt at bringing everything together.
    4.38 -
    4.39 -* The creature's body
    4.40 -
    4.41 -Still going to do an eve-like body in blender, but due to problems
    4.42 -importing the joints, etc into jMonkeyEngine3, I'm going to do all
    4.43 -the connecting here in clojure code, using the names of the individual
    4.44 -components and trial and error. Later, I'll maybe make some sort of
    4.45 -creature-building modifications to blender that support whatever
    4.46 -discritized senses I'm going to make.
    4.47 +This is the ultimate test which features all of the senses that I've
    4.48 +made so far. The blender file for the creature serves as an example of
    4.49 +a fully equipped creature in terms of senses. You can find it [[../assets/Models/test-creature/hand.blend][here]].
    4.50  
    4.51  #+name: integration
    4.52  #+begin_src clojure 
    4.53  (ns cortex.integration
    4.54    "let's play!"
    4.55    {:author "Robert McIntyre"}
    4.56 -  (:use (cortex world util body
    4.57 -                hearing touch vision sense proprioception movement))
    4.58 +  (:use (cortex world util body sense
    4.59 +                hearing touch vision proprioception movement))
    4.60    (:import (com.jme3.math ColorRGBA Vector3f))
    4.61 +  (:import java.io.File)
    4.62    (:import com.jme3.audio.AudioNode)
    4.63    (:import com.aurellem.capture.RatchetTimer))
    4.64  
    4.65 -(def hand "Models/creature1/one.blend")
    4.66 +(dorun (cortex.import/mega-import-jme3))
    4.67 +(rlm.rlm-commands/help)
    4.68  
    4.69 -(def worm "Models/creature1/try-again.blend")
    4.70 +(def hand "Models/test-creature/hand.blend")
    4.71  
    4.72 -(defn test-creature [thing]
    4.73 -  (let [x-axis
    4.74 -        (box 1 0.01 0.01 :physical? false :color ColorRGBA/Red)
    4.75 -        y-axis
    4.76 -        (box 0.01 1 0.01 :physical? false :color ColorRGBA/Green)
    4.77 -        z-axis
    4.78 -        (box 0.01 0.01 1 :physical? false :color ColorRGBA/Blue)
    4.79 +(def output-base (File. "/home/r/proj/cortex/render/hand"))
    4.80  
    4.81 -        me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
    4.82 +(defn test-everything! 
    4.83 +  ([] (test-everything! false))
    4.84 +  ([record?]
    4.85 +  (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
    4.86 +
    4.87          bell (AudioNode. (asset-manager)
    4.88                           "Sounds/pure.wav" false)
    4.89  
    4.90 -        fix-display
    4.91 -        (runonce (fn [world]
    4.92 -                   (add-camera! world (.getCamera world) no-op)))
    4.93 -        creature (doto (load-blender-model thing) (body!))
    4.94  
    4.95 +
    4.96 +        creature (doto (load-blender-model hand) 
    4.97 +                   (body!))
    4.98 +        
    4.99          ;;;;;;;;;;;;  Sensors/Effectors  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.100          touch (touch! creature)
   4.101          touch-display (view-touch)
   4.102 @@ -87,12 +59,14 @@
   4.103  
   4.104          muscle-exertion (atom 0)
   4.105          muscles (movement! creature)
   4.106 -        muscle-display (view-movement)]
   4.107 +        muscle-display (view-movement)
   4.108 +        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   4.109  
   4.110 +        fix-display (gen-fix-display)]
   4.111      (apply
   4.112       world
   4.113       (with-movement
   4.114 -       (.getChild creature "worm-21")
   4.115 +       (.getChild creature "palm")
   4.116         ["key-r" "key-t"
   4.117          "key-f" "key-g"
   4.118          "key-v" "key-b"]
   4.119 @@ -100,7 +74,6 @@
   4.120         [(nodify [creature
   4.121                   (box 10 2 10 :position (Vector3f. 0 -9 0)
   4.122                        :color ColorRGBA/Gray :mass 0)
   4.123 -                 x-axis y-axis z-axis
   4.124                   me])
   4.125          (merge standard-debug-controls
   4.126                 {"key-return"
   4.127 @@ -118,6 +91,7 @@
   4.128                    (if value
   4.129                      (swap! muscle-exertion (fn [v] (- v 20)))))})
   4.130          (fn [world]
   4.131 +          (.setTimer world (RatchetTimer. 60))
   4.132            (light-up-everything world)
   4.133            (enable-debug world)
   4.134            (add-camera! world
   4.135 @@ -125,12 +99,7 @@
   4.136                                   (.getChild 
   4.137                                    (.getChild creature "eyes") "eye"))
   4.138                     (comp (view-image) BufferedImage!))
   4.139 -          (.setTimer world (RatchetTimer. 60))
   4.140 -          (speed-up world)
   4.141 -          (set-gravity world (Vector3f. 0 0 0))
   4.142 -          (comment 
   4.143 -            (com.aurellem.capture.Capture/captureVideo
   4.144 -             world (file-str "/home/r/proj/ai-videos/hand"))))
   4.145 +          (speed-up world))
   4.146          (fn [world tpf]
   4.147            (prop-display (prop))
   4.148            (touch-display (map #(% (.getRootNode world)) touch))
   4.149 @@ -138,16 +107,11 @@
   4.150            (hearing-display (map #(% world) hearing))
   4.151            (muscle-display (map #(% @muscle-exertion) muscles))
   4.152            (.setLocalTranslation me (.getLocation (.getCamera world)))
   4.153 -          (fix-display world))]))))
   4.154 +          (fix-display world))])))))
   4.155  #+end_src
   4.156  
   4.157 -#+results: body-1
   4.158 -: #'cortex.silly/follow-test
   4.159 -
   4.160 -
   4.161  * COMMENT purgatory
   4.162  #+begin_src clojure
   4.163 -
   4.164  (defn bullet-trans* []
   4.165    (let [obj-a (box 1.5 0.5 0.5 :color ColorRGBA/Red
   4.166                     :position (Vector3f. 5 0 0)