changeset 244:f23217324f72

changed semantics of feeler lengths
author Robert McIntyre <rlm@mit.edu>
date Sun, 12 Feb 2012 14:29:09 -0700
parents f33fec68f775
children 102ac596cc3f
files org/touch.org
diffstat 1 files changed, 10 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/org/touch.org	Sun Feb 12 14:14:57 2012 -0700
     1.2 +++ b/org/touch.org	Sun Feb 12 14:29:09 2012 -0700
     1.3 @@ -6,8 +6,6 @@
     1.4  #+SETUPFILE: ../../aurellem/org/setup.org
     1.5  #+INCLUDE: ../../aurellem/org/level-0.org
     1.6  
     1.7 -
     1.8 -
     1.9  * Touch
    1.10  
    1.11  Touch is critical to navigation and spatial reasoning and as such I
    1.12 @@ -118,15 +116,14 @@
    1.13  
    1.14  (declare touch-topology feelers set-ray)
    1.15  
    1.16 -(defn set-ray [#^Ray ray #^Matrix4f transform #^Vector3f origin
    1.17 -               #^Vector3f tip length]
    1.18 +(defn set-ray [#^Ray ray #^Matrix4f transform
    1.19 +               #^Vector3f origin #^Vector3f tip]
    1.20    ;; Doing everything locally recduces garbage collection by enough to
    1.21    ;; be worth it.
    1.22    (.mult transform origin (.getOrigin ray))
    1.23    
    1.24    (.mult transform tip (.getDirection ray))
    1.25 -  (.subtractLocal (.getDirection ray) (.getOrigin ray))
    1.26 -  (.setLimit ray length))
    1.27 +  (.subtractLocal (.getDirection ray) (.getOrigin ray)))
    1.28  
    1.29  (defn touch-kernel
    1.30    "Constructs a function which will return tactile sensory data from
    1.31 @@ -136,16 +133,17 @@
    1.32        [profile (tactile-sensor-profile geo)]
    1.33      (let [ray-reference-origins (feeler-origins geo profile)
    1.34            ray-reference-tips (feeler-tips geo profile)
    1.35 -          ray-lengths (repeat 9000 0.1)
    1.36 +          ray-length (tactile-scale geo)
    1.37            current-rays (map (fn [_] (Ray.)) ray-reference-origins)
    1.38            topology (touch-topology geo profile)]
    1.39 +      (dorun (map #(.setLimit % ray-length) current-rays))
    1.40        (fn [node]
    1.41          (let [transform (.getWorldMatrix geo)]
    1.42            (dorun
    1.43 -           (map (fn [ray ref-origin ref-tip length]
    1.44 -                  (set-ray ray transform ref-origin ref-tip length))
    1.45 +           (map (fn [ray ref-origin ref-tip]
    1.46 +                  (set-ray ray transform ref-origin ref-tip))
    1.47                  current-rays ray-reference-origins
    1.48 -                ray-reference-tips ray-lengths))
    1.49 +                ray-reference-tips))
    1.50            (vector
    1.51             topology
    1.52             (vec
    1.53 @@ -480,14 +478,11 @@
    1.54             standard-debug-controls
    1.55             
    1.56             (fn [world]
    1.57 +             (speed-up world)
    1.58               (light-up-everything world))
    1.59  
    1.60             (fn [world tpf]
    1.61 -
    1.62 -             
    1.63 -             (dorun (map #(% (.getRootNode world)) touch))
    1.64 -
    1.65 -
    1.66 +             (touch-display (map #(% (.getRootNode world)) touch))
    1.67               ))))
    1.68  #+end_src
    1.69  * Source Listing