comparison org/test-creature.org @ 126:0efe6f04bc26

greatly enhanced touch sensitivity
author Robert McIntyre <rlm@mit.edu>
date Wed, 25 Jan 2012 04:54:48 -0700
parents 3d65633dd736
children bc49d452c42a
comparison
equal deleted inserted replaced
125:3d65633dd736 126:0efe6f04bc26
7 #+INCLUDE: ../../aurellem/org/level-0.org 7 #+INCLUDE: ../../aurellem/org/level-0.org
8 8
9 * ideas 9 * ideas
10 10
11 ** have to get done before winston 11 ** have to get done before winston
12 - [ ] write an explination for why greyscale bitmaps for senses is appropiate 12 - [ ] write an explination for why greyscale bitmaps for senses is
13 - [ ] muscle control 13 appropiate -- 1/2 day
14 - [ ] proprioception sensor map in the style of the other senses 14 - [ ] muscle control -- day
15 - [ ] enable greyscale bitmaps for touch 15 - [ ] proprioception sensor map in the style of the other senses -- day
16 - [ ] refactor integration code to distribute to each of the senses 16 - [ ] refactor integration code to distribute to each of the senses
17 - [ ] create video showing all the senses for Winston 17 -- day
18 - [ ] write summary for Winston 18 - [ ] create video showing all the senses for Winston -- 2 days
19 - [ ] project proposals for Winston 19 - [ ] write summary of project for Winston \
20 - [ ] send winston package 20 - [ ] project proposals for Winston \
21 - [ ] additional senses to be implemented for Winston | -- 2 days
22 - [ ] send Winston package /
21 23
22 ** would be cool to get done before winston 24 ** would be cool to get done before winston
23 - [ ] use sawfish to auto-tile sense windows 25 - [X] enable greyscale bitmaps for touch -- 2 hours
24 - [ ] sawfish keybinding to automatically delete all sense windows 26 - [X] use sawfish to auto-tile sense windows -- 6 hours
25 - [ ] proof of concept C sense manipulation 27 - [X] sawfish keybinding to automatically delete all sense windows
26 - [ ] proof of concept GPU sense manipulation 28 - [ ] directly change the UV-pixels to show sensor activation -- 2
27 - [ ] fourier view of sound 29 days
28 - [ ] directly change the UV-pixels to show sensor activation 30 - [ ] proof of concept C sense manipulation -- 2 days
31 - [ ] proof of concept GPU sense manipulation -- week
32 - [ ] fourier view of sound -- 2 or 3 days
33 - [ ] dancing music generator
29 34
30 ** don't have to get done before winston 35 ** don't have to get done before winston
31 - [ ] write tests for integration 36 - [ ] write tests for integration -- 3 days
32 - [ ] usertime/gametime clock HUD display 37 - [ ] usertime/gametime clock HUD display -- day
33 - [ ] find papers for each of the senses justifying my own representation 38 - [ ] find papers for each of the senses justifying my own
34 - [ ] show sensor maps in HUD display? 39 representation -- week
40 - [ ] show sensor maps in HUD display? -- 4 days
41 - [ ] show sensor maps in AWT display? -- 2 days
35 42
36 43
37 * Intro 44 * Intro
38 So far, I've made the following senses -- 45 So far, I've made the following senses --
39 - Vision 46 - Vision
627 (for [ray rays] 634 (for [ray rays]
628 (do 635 (do
629 (let [results (CollisionResults.)] 636 (let [results (CollisionResults.)]
630 (.collideWith node ray results) 637 (.collideWith node ray results)
631 (let [touch-objects 638 (let [touch-objects
632 (set 639 (filter #(not (= geo (.getGeometry %)))
633 (filter #(not (= geo %)) 640 results)]
634 (map #(.getGeometry %) results)))] 641 (- 255
635 (if (> (count touch-objects) 0) 642 (if (empty? touch-objects) 255
636 1 0)))))))))))) 643 (rem
644 (int
645 (* 255 (/ (.getDistance
646 (first touch-objects)) limit)))
647 256))))))))))))))
648
637 649
638 (defn touch [#^Node pieces] 650 (defn touch [#^Node pieces]
639 (filter (comp not nil?) 651 (filter (comp not nil?)
640 (map enable-touch 652 (map enable-touch
641 (filter #(isa? (class %) Geometry) 653 (filter #(isa? (class %) Geometry)
908 (if-let [joint-node (.getChild model "joints")] 920 (if-let [joint-node (.getChild model "joints")]
909 (seq (.getChildren joint-node)) 921 (seq (.getChildren joint-node))
910 (do (println-repl "could not find joints node") []))] 922 (do (println-repl "could not find joints node") []))]
911 (assemble-creature model joints))) 923 (assemble-creature model joints)))
912 924
925 (defn gray-scale [num]
926 (+ num
927 (bit-shift-left num 8)
928 (bit-shift-left num 16)))
929
913 (defn debug-window 930 (defn debug-window
914 "creates function that offers a debug view of sensor data" 931 "creates function that offers a debug view of sensor data"
915 [] 932 []
916 (let [vi (view-image)] 933 (let [vi (view-image)]
917 (fn 934 (fn
918 [[coords sensor-data]] 935 [[coords sensor-data]]
919 (let [image (points->image coords)] 936 (let [image (points->image coords)]
920 (dorun 937 (dorun
921 (for [i (range (count coords))] 938 (for [i (range (count coords))]
922 (.setRGB image ((coords i) 0) ((coords i) 1) 939 (.setRGB image ((coords i) 0) ((coords i) 1)
923 ({0 0x000000 940 (gray-scale (sensor-data i)))))
924 1 0xFFFFFF} (sensor-data i))))) 941
942
925 (vi image))))) 943 (vi image)))))
926 944
927 (defn debug-vision-window 945 (defn debug-vision-window
928 "creates function that offers a debug view of sensor data" 946 "creates function that offers a debug view of sensor data"
929 [] 947 []
947 (dorun 965 (dorun
948 (for [x (range (count coords))] 966 (for [x (range (count coords))]
949 (dorun 967 (dorun
950 (for [y (range height)] 968 (for [y (range height)]
951 (let [raw-sensor (sensor-data x)] 969 (let [raw-sensor (sensor-data x)]
952 (.setRGB image x y 970 (.setRGB image x y (gray-scale raw-sensor)))))))
953 (+ raw-sensor 971
954 (bit-shift-left raw-sensor 8)
955 (bit-shift-left raw-sensor 16))))))))
956 (vi image))))) 972 (vi image)))))
957 973
958 974
959 975
960 ;;(defn test-touch [world creature] 976 ;;(defn test-touch [world creature]