Mercurial > cortex
comparison org/touch.org @ 188:22548d48cc85
added debug for vision
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 04 Feb 2012 10:00:37 -0700 |
parents | 6142e85f5825 |
children | facc2ef3fe5c |
comparison
equal
deleted
inserted
replaced
187:6142e85f5825 | 188:22548d48cc85 |
---|---|
298 (comp not nil?) | 298 (comp not nil?) |
299 (map touch-fn | 299 (map touch-fn |
300 (filter #(isa? (class %) Geometry) | 300 (filter #(isa? (class %) Geometry) |
301 (node-seq creature))))) | 301 (node-seq creature))))) |
302 | 302 |
303 (defn gray | 303 (defn view-touch |
304 "Create a gray RGB pixel with R, G, and B set to 'num" | 304 "Creates a function which accepts touch sensor-data and displays it |
305 [num] | 305 to the screen." |
306 (+ num | 306 [] |
307 (bit-shift-left num 8) | |
308 (bit-shift-left num 16))) | |
309 | |
310 (defvar | |
311 view-touch | |
312 (view-sense | 307 (view-sense |
313 (fn | 308 (fn |
314 [[coords sensor-data]] | 309 [[coords sensor-data]] |
315 (let [image (points->image coords)] | 310 (let [image (points->image coords)] |
316 (dorun | 311 (dorun |
317 (for [i (range (count coords))] | 312 (for [i (range (count coords))] |
318 (.setRGB image ((coords i) 0) ((coords i) 1) | 313 (.setRGB image ((coords i) 0) ((coords i) 1) |
319 (gray (sensor-data i))))) | 314 (gray (sensor-data i))))) |
320 image))) | 315 image)))) |
321 "Creates a function which accepts touch sensor-data and displays it | |
322 as BufferedImages in JFrames.") | |
323 | 316 |
324 | 317 |
325 #+end_src | 318 #+end_src |
326 | 319 |
327 | 320 |