Mercurial > cortex
diff org/integration.org @ 281:7351c9c0c471
resurrected integration test.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 15 Feb 2012 11:13:12 -0700 |
parents | 305439cec54d |
children | 2ad29b68ff22 |
line wrap: on
line diff
1.1 --- a/org/integration.org Wed Feb 15 10:31:51 2012 -0700 1.2 +++ b/org/integration.org Wed Feb 15 11:13:12 2012 -0700 1.3 @@ -1,4 +1,4 @@ 1.4 -#+title: First attempt at a creature! 1.5 +#+title: 1.6 #+author: Robert McIntyre 1.7 #+email: rlm@mit.edu 1.8 #+description: 1.9 @@ -6,72 +6,44 @@ 1.10 #+SETUPFILE: ../../aurellem/org/setup.org 1.11 #+INCLUDE: ../../aurellem/org/level-0.org 1.12 1.13 +* Intro 1.14 1.15 - 1.16 - 1.17 -* Intro 1.18 -So far, I've made the following senses -- 1.19 - - Vision 1.20 - - Hearing 1.21 - - Touch 1.22 - - Proprioception 1.23 - 1.24 -And one effector: 1.25 - - Movement 1.26 - 1.27 -However, the code so far has only enabled these senses, but has not 1.28 -actually implemented them. For example, there is still a lot of work 1.29 -to be done for vision. I need to be able to create an /eyeball/ in 1.30 -simulation that can be moved around and see the world from different 1.31 -angles. I also need to determine weather to use log-polar or cartesian 1.32 -for the visual input, and I need to determine how/wether to 1.33 -disceritise the visual input. 1.34 - 1.35 -I also want to be able to visualize both the sensors and the 1.36 -effectors in pretty pictures. This semi-retarted creature will be my 1.37 -first attempt at bringing everything together. 1.38 - 1.39 -* The creature's body 1.40 - 1.41 -Still going to do an eve-like body in blender, but due to problems 1.42 -importing the joints, etc into jMonkeyEngine3, I'm going to do all 1.43 -the connecting here in clojure code, using the names of the individual 1.44 -components and trial and error. Later, I'll maybe make some sort of 1.45 -creature-building modifications to blender that support whatever 1.46 -discritized senses I'm going to make. 1.47 +This is the ultimate test which features all of the senses that I've 1.48 +made so far. The blender file for the creature serves as an example of 1.49 +a fully equipped creature in terms of senses. You can find it [[../assets/Models/test-creature/hand.blend][here]]. 1.50 1.51 #+name: integration 1.52 #+begin_src clojure 1.53 (ns cortex.integration 1.54 "let's play!" 1.55 {:author "Robert McIntyre"} 1.56 - (:use (cortex world util body 1.57 - hearing touch vision sense proprioception movement)) 1.58 + (:use (cortex world util body sense 1.59 + hearing touch vision proprioception movement)) 1.60 (:import (com.jme3.math ColorRGBA Vector3f)) 1.61 + (:import java.io.File) 1.62 (:import com.jme3.audio.AudioNode) 1.63 (:import com.aurellem.capture.RatchetTimer)) 1.64 1.65 -(def hand "Models/creature1/one.blend") 1.66 +(dorun (cortex.import/mega-import-jme3)) 1.67 +(rlm.rlm-commands/help) 1.68 1.69 -(def worm "Models/creature1/try-again.blend") 1.70 +(def hand "Models/test-creature/hand.blend") 1.71 1.72 -(defn test-creature [thing] 1.73 - (let [x-axis 1.74 - (box 1 0.01 0.01 :physical? false :color ColorRGBA/Red) 1.75 - y-axis 1.76 - (box 0.01 1 0.01 :physical? false :color ColorRGBA/Green) 1.77 - z-axis 1.78 - (box 0.01 0.01 1 :physical? false :color ColorRGBA/Blue) 1.79 +(def output-base (File. "/home/r/proj/cortex/render/hand")) 1.80 1.81 - me (sphere 0.5 :color ColorRGBA/Blue :physical? false) 1.82 +(defn test-everything! 1.83 + ([] (test-everything! false)) 1.84 + ([record?] 1.85 + (let [me (sphere 0.5 :color ColorRGBA/Blue :physical? false) 1.86 + 1.87 bell (AudioNode. (asset-manager) 1.88 "Sounds/pure.wav" false) 1.89 1.90 - fix-display 1.91 - (runonce (fn [world] 1.92 - (add-camera! world (.getCamera world) no-op))) 1.93 - creature (doto (load-blender-model thing) (body!)) 1.94 1.95 + 1.96 + creature (doto (load-blender-model hand) 1.97 + (body!)) 1.98 + 1.99 ;;;;;;;;;;;; Sensors/Effectors ;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1.100 touch (touch! creature) 1.101 touch-display (view-touch) 1.102 @@ -87,12 +59,14 @@ 1.103 1.104 muscle-exertion (atom 0) 1.105 muscles (movement! creature) 1.106 - muscle-display (view-movement)] 1.107 + muscle-display (view-movement) 1.108 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1.109 1.110 + fix-display (gen-fix-display)] 1.111 (apply 1.112 world 1.113 (with-movement 1.114 - (.getChild creature "worm-21") 1.115 + (.getChild creature "palm") 1.116 ["key-r" "key-t" 1.117 "key-f" "key-g" 1.118 "key-v" "key-b"] 1.119 @@ -100,7 +74,6 @@ 1.120 [(nodify [creature 1.121 (box 10 2 10 :position (Vector3f. 0 -9 0) 1.122 :color ColorRGBA/Gray :mass 0) 1.123 - x-axis y-axis z-axis 1.124 me]) 1.125 (merge standard-debug-controls 1.126 {"key-return" 1.127 @@ -118,6 +91,7 @@ 1.128 (if value 1.129 (swap! muscle-exertion (fn [v] (- v 20)))))}) 1.130 (fn [world] 1.131 + (.setTimer world (RatchetTimer. 60)) 1.132 (light-up-everything world) 1.133 (enable-debug world) 1.134 (add-camera! world 1.135 @@ -125,12 +99,7 @@ 1.136 (.getChild 1.137 (.getChild creature "eyes") "eye")) 1.138 (comp (view-image) BufferedImage!)) 1.139 - (.setTimer world (RatchetTimer. 60)) 1.140 - (speed-up world) 1.141 - (set-gravity world (Vector3f. 0 0 0)) 1.142 - (comment 1.143 - (com.aurellem.capture.Capture/captureVideo 1.144 - world (file-str "/home/r/proj/ai-videos/hand")))) 1.145 + (speed-up world)) 1.146 (fn [world tpf] 1.147 (prop-display (prop)) 1.148 (touch-display (map #(% (.getRootNode world)) touch)) 1.149 @@ -138,16 +107,11 @@ 1.150 (hearing-display (map #(% world) hearing)) 1.151 (muscle-display (map #(% @muscle-exertion) muscles)) 1.152 (.setLocalTranslation me (.getLocation (.getCamera world))) 1.153 - (fix-display world))])))) 1.154 + (fix-display world))]))))) 1.155 #+end_src 1.156 1.157 -#+results: body-1 1.158 -: #'cortex.silly/follow-test 1.159 - 1.160 - 1.161 * COMMENT purgatory 1.162 #+begin_src clojure 1.163 - 1.164 (defn bullet-trans* [] 1.165 (let [obj-a (box 1.5 0.5 0.5 :color ColorRGBA/Red 1.166 :position (Vector3f. 5 0 0)