# HG changeset patch # User Robert McIntyre # Date 1329329592 25200 # Node ID 7351c9c0c471e8777cdef7a024ccf5efa9f3b5e7 # Parent 301e91a6c2d116193b4c1a2f8fa93a4795f7c3b6 resurrected integration test. diff -r 301e91a6c2d1 -r 7351c9c0c471 assets/Models/test-creature/hand.blend Binary file assets/Models/test-creature/hand.blend has changed diff -r 301e91a6c2d1 -r 7351c9c0c471 assets/Models/test-creature/palm-retina.png Binary file assets/Models/test-creature/palm-retina.png has changed diff -r 301e91a6c2d1 -r 7351c9c0c471 org/capture-video.org --- a/org/capture-video.org Wed Feb 15 10:31:51 2012 -0700 +++ b/org/capture-video.org Wed Feb 15 11:13:12 2012 -0700 @@ -757,31 +757,3 @@ videoscale ! ffmpegcolorspace ! \ video/x-raw-yuv, width=640, height=480, framerate=25/1 ! \ videobox right=-640 ! mix. - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 301e91a6c2d1 -r 7351c9c0c471 org/integration.org --- a/org/integration.org Wed Feb 15 10:31:51 2012 -0700 +++ b/org/integration.org Wed Feb 15 11:13:12 2012 -0700 @@ -1,4 +1,4 @@ -#+title: First attempt at a creature! +#+title: #+author: Robert McIntyre #+email: rlm@mit.edu #+description: @@ -6,72 +6,44 @@ #+SETUPFILE: ../../aurellem/org/setup.org #+INCLUDE: ../../aurellem/org/level-0.org +* Intro - - -* Intro -So far, I've made the following senses -- - - Vision - - Hearing - - Touch - - Proprioception - -And one effector: - - Movement - -However, the code so far has only enabled these senses, but has not -actually implemented them. For example, there is still a lot of work -to be done for vision. I need to be able to create an /eyeball/ in -simulation that can be moved around and see the world from different -angles. I also need to determine weather to use log-polar or cartesian -for the visual input, and I need to determine how/wether to -disceritise the visual input. - -I also want to be able to visualize both the sensors and the -effectors in pretty pictures. This semi-retarted creature will be my -first attempt at bringing everything together. - -* The creature's body - -Still going to do an eve-like body in blender, but due to problems -importing the joints, etc into jMonkeyEngine3, I'm going to do all -the connecting here in clojure code, using the names of the individual -components and trial and error. Later, I'll maybe make some sort of -creature-building modifications to blender that support whatever -discritized senses I'm going to make. +This is the ultimate test which features all of the senses that I've +made so far. The blender file for the creature serves as an example of +a fully equipped creature in terms of senses. You can find it [[../assets/Models/test-creature/hand.blend][here]]. #+name: integration #+begin_src clojure (ns cortex.integration "let's play!" {:author "Robert McIntyre"} - (:use (cortex world util body - hearing touch vision sense proprioception movement)) + (:use (cortex world util body sense + hearing touch vision proprioception movement)) (:import (com.jme3.math ColorRGBA Vector3f)) + (:import java.io.File) (:import com.jme3.audio.AudioNode) (:import com.aurellem.capture.RatchetTimer)) -(def hand "Models/creature1/one.blend") +(dorun (cortex.import/mega-import-jme3)) +(rlm.rlm-commands/help) -(def worm "Models/creature1/try-again.blend") +(def hand "Models/test-creature/hand.blend") -(defn test-creature [thing] - (let [x-axis - (box 1 0.01 0.01 :physical? false :color ColorRGBA/Red) - y-axis - (box 0.01 1 0.01 :physical? false :color ColorRGBA/Green) - z-axis - (box 0.01 0.01 1 :physical? false :color ColorRGBA/Blue) +(def output-base (File. "/home/r/proj/cortex/render/hand")) - me (sphere 0.5 :color ColorRGBA/Blue :physical? false) +(defn test-everything! + ([] (test-everything! false)) + ([record?] + (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false) + bell (AudioNode. (asset-manager) "Sounds/pure.wav" false) - fix-display - (runonce (fn [world] - (add-camera! world (.getCamera world) no-op))) - creature (doto (load-blender-model thing) (body!)) + + creature (doto (load-blender-model hand) + (body!)) + ;;;;;;;;;;;; Sensors/Effectors ;;;;;;;;;;;;;;;;;;;;;;;;;;;; touch (touch! creature) touch-display (view-touch) @@ -87,12 +59,14 @@ muscle-exertion (atom 0) muscles (movement! creature) - muscle-display (view-movement)] + muscle-display (view-movement) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + fix-display (gen-fix-display)] (apply world (with-movement - (.getChild creature "worm-21") + (.getChild creature "palm") ["key-r" "key-t" "key-f" "key-g" "key-v" "key-b"] @@ -100,7 +74,6 @@ [(nodify [creature (box 10 2 10 :position (Vector3f. 0 -9 0) :color ColorRGBA/Gray :mass 0) - x-axis y-axis z-axis me]) (merge standard-debug-controls {"key-return" @@ -118,6 +91,7 @@ (if value (swap! muscle-exertion (fn [v] (- v 20)))))}) (fn [world] + (.setTimer world (RatchetTimer. 60)) (light-up-everything world) (enable-debug world) (add-camera! world @@ -125,12 +99,7 @@ (.getChild (.getChild creature "eyes") "eye")) (comp (view-image) BufferedImage!)) - (.setTimer world (RatchetTimer. 60)) - (speed-up world) - (set-gravity world (Vector3f. 0 0 0)) - (comment - (com.aurellem.capture.Capture/captureVideo - world (file-str "/home/r/proj/ai-videos/hand")))) + (speed-up world)) (fn [world tpf] (prop-display (prop)) (touch-display (map #(% (.getRootNode world)) touch)) @@ -138,16 +107,11 @@ (hearing-display (map #(% world) hearing)) (muscle-display (map #(% @muscle-exertion) muscles)) (.setLocalTranslation me (.getLocation (.getCamera world))) - (fix-display world))])))) + (fix-display world))]))))) #+end_src -#+results: body-1 -: #'cortex.silly/follow-test - - * COMMENT purgatory #+begin_src clojure - (defn bullet-trans* [] (let [obj-a (box 1.5 0.5 0.5 :color ColorRGBA/Red :position (Vector3f. 5 0 0)