Mercurial > cortex
comparison org/test-creature.org @ 188:22548d48cc85
added debug for vision
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 04 Feb 2012 10:00:37 -0700 |
parents | cfb71209ddc6 |
children | facc2ef3fe5c |
comparison
equal
deleted
inserted
replaced
187:6142e85f5825 | 188:22548d48cc85 |
---|---|
106 ;; higher level -- organs | 106 ;; higher level -- organs |
107 ;; | 107 ;; |
108 | 108 |
109 ;; higher level --- sense/effector | 109 ;; higher level --- sense/effector |
110 ;; these are the functions that provide world i/o, chinese-room style | 110 ;; these are the functions that provide world i/o, chinese-room style |
111 | |
112 | |
113 (defn debug-vision-window | |
114 "creates function that offers a debug view of sensor data" | |
115 [] | |
116 (let [vi (view-image)] | |
117 (fn | |
118 [[coords sensor-data]] | |
119 (let [image (points->image coords)] | |
120 (dorun | |
121 (for [i (range (count coords))] | |
122 (.setRGB image ((coords i) 0) ((coords i) 1) | |
123 (sensor-data i)))) | |
124 (vi image))))) | |
125 | 111 |
126 (defn debug-hearing-window | 112 (defn debug-hearing-window |
127 "view audio data" | 113 "view audio data" |
128 [height] | 114 [height] |
129 (let [vi (view-image)] | 115 (let [vi (view-image)] |
133 (dorun | 119 (dorun |
134 (for [x (range (count coords))] | 120 (for [x (range (count coords))] |
135 (dorun | 121 (dorun |
136 (for [y (range height)] | 122 (for [y (range height)] |
137 (let [raw-sensor (sensor-data x)] | 123 (let [raw-sensor (sensor-data x)] |
138 (.setRGB image x y (gray-scale raw-sensor))))))) | 124 (.setRGB image x y (gray raw-sensor))))))) |
139 | 125 |
140 (vi image))))) | 126 (vi image))))) |
141 | 127 |
142 (defn test-creature [thing] | 128 (defn test-creature [thing] |
143 (let [x-axis | 129 (let [x-axis |
148 (box 0.01 0.01 1 :physical? false :color ColorRGBA/Blue) | 134 (box 0.01 0.01 1 :physical? false :color ColorRGBA/Blue) |
149 creature (doto | 135 creature (doto |
150 (load-blender-model thing) | 136 (load-blender-model thing) |
151 (body!)) | 137 (body!)) |
152 touch (touch! creature) | 138 touch (touch! creature) |
153 touch-view (view-touch) | 139 touch-display (view-touch) |
154 vision-data (vision! creature) | 140 vision (vision! creature) |
155 vision-debug (map (fn [_] (debug-vision-window)) vision-data) | 141 vision-display (view-vision) |
156 me (sphere 0.5 :color ColorRGBA/Blue :physical? false) | 142 me (sphere 0.5 :color ColorRGBA/Blue :physical? false) |
157 hearing-senses (hearing! creature) | 143 hearing-senses (hearing! creature) |
158 hearing-windows (map (fn [_] (debug-hearing-window 50)) | 144 hearing-windows (map (fn [_] (debug-hearing-window 50)) |
159 hearing-senses) | 145 hearing-senses) |
160 bell (AudioNode. (asset-manager) | 146 bell (AudioNode. (asset-manager) |
220 ;;(dorun | 206 ;;(dorun |
221 ;; (map #(%1 %2) touch-nerves (repeat (.getRootNode world)))) | 207 ;; (map #(%1 %2) touch-nerves (repeat (.getRootNode world)))) |
222 | 208 |
223 (prop-debug (prop)) | 209 (prop-debug (prop)) |
224 | 210 |
225 (touch-view (map #(% (.getRootNode world)) touch)) | 211 (touch-display (map #(% (.getRootNode world)) touch)) |
226 | 212 |
227 (dorun | 213 (vision-display (map #(% world) vision)) |
228 (map #(%1 (%2 world)) | 214 |
229 vision-debug vision-data)) | |
230 (dorun | 215 (dorun |
231 (map #(%1 (%2 world)) hearing-windows hearing-senses)) | 216 (map #(%1 (%2 world)) hearing-windows hearing-senses)) |
232 | 217 |
233 | 218 |
234 ;;(println-repl (vision-data)) | 219 ;;(println-repl (vision-data)) |