comparison org/test-creature.org @ 185:cfb71209ddc6

moved touch-debug view to touch.org
author Robert McIntyre <rlm@mit.edu>
date Sat, 04 Feb 2012 09:33:13 -0700
parents f1b078375484
children 22548d48cc85
comparison
equal deleted inserted replaced
184:bdca0daa3778 185:cfb71209ddc6
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 111
112
113
114
115
116 (defn gray-scale [num]
117 (+ num
118 (bit-shift-left num 8)
119 (bit-shift-left num 16)))
120
121 (defn debug-touch-window
122 "creates function that offers a debug view of sensor data"
123 []
124 (let [vi (view-image)]
125 (fn
126 [[coords sensor-data]]
127 (let [image (points->image coords)]
128 (dorun
129 (for [i (range (count coords))]
130 (.setRGB image ((coords i) 0) ((coords i) 1)
131 (gray-scale (sensor-data i)))))
132
133
134 (vi image)))))
135 112
136 (defn debug-vision-window 113 (defn debug-vision-window
137 "creates function that offers a debug view of sensor data" 114 "creates function that offers a debug view of sensor data"
138 [] 115 []
139 (let [vi (view-image)] 116 (let [vi (view-image)]
170 z-axis 147 z-axis
171 (box 0.01 0.01 1 :physical? false :color ColorRGBA/Blue) 148 (box 0.01 0.01 1 :physical? false :color ColorRGBA/Blue)
172 creature (doto 149 creature (doto
173 (load-blender-model thing) 150 (load-blender-model thing)
174 (body!)) 151 (body!))
175 touch-nerves (touch! creature) 152 touch (touch! creature)
176 touch-debug-windows (map (fn [_] (debug-touch-window)) touch-nerves) 153 touch-view (view-touch)
177 vision-data (vision! creature) 154 vision-data (vision! creature)
178 vision-debug (map (fn [_] (debug-vision-window)) vision-data) 155 vision-debug (map (fn [_] (debug-vision-window)) vision-data)
179 me (sphere 0.5 :color ColorRGBA/Blue :physical? false) 156 me (sphere 0.5 :color ColorRGBA/Blue :physical? false)
180 hearing-senses (hearing! creature) 157 hearing-senses (hearing! creature)
181 hearing-windows (map (fn [_] (debug-hearing-window 50)) 158 hearing-windows (map (fn [_] (debug-hearing-window 50))
243 ;;(dorun 220 ;;(dorun
244 ;; (map #(%1 %2) touch-nerves (repeat (.getRootNode world)))) 221 ;; (map #(%1 %2) touch-nerves (repeat (.getRootNode world))))
245 222
246 (prop-debug (prop)) 223 (prop-debug (prop))
247 224
248 (dorun 225 (touch-view (map #(% (.getRootNode world)) touch))
249 (map #(%1 (%2 (.getRootNode world)))
250 touch-debug-windows touch-nerves))
251 226
252 (dorun 227 (dorun
253 (map #(%1 (%2 world)) 228 (map #(%1 (%2 world))
254 vision-debug vision-data)) 229 vision-debug vision-data))
255 (dorun 230 (dorun