diff org/movement.org @ 296:1eed471e2ebf

first version of a mini motor-control script language
author Robert McIntyre <rlm@mit.edu>
date Thu, 16 Feb 2012 11:04:22 -0700
parents 67a4e92d4628
children 7e7f8d6d9ec5
line wrap: on
line diff
     1.1 --- a/org/movement.org	Thu Feb 16 09:59:44 2012 -0700
     1.2 +++ b/org/movement.org	Thu Feb 16 11:04:22 2012 -0700
     1.3 @@ -118,15 +118,14 @@
     1.4          
     1.5          pool (motor-pool muscle)
     1.6          pool-integral (reductions + pool)
     1.7 -        force-index
     1.8 +        forces
     1.9          (vec (map  #(float (* strength (/ % (last pool-integral))))
    1.10                pool-integral))
    1.11          control (.getControl target RigidBodyControl)]
    1.12 -    (println-repl "adding muscle to" (.getName target))
    1.13 -    (println-repl "points" axis)
    1.14 +    (println-repl (.getName target) axis)
    1.15      (fn [n]
    1.16        (let [pool-index (max 0 (min n (dec (count pool))))
    1.17 -            force (force-index pool-index)]
    1.18 +            force (forces pool-index)]
    1.19          (.applyTorque control (.mult axis force))
    1.20          (float (/ force strength))))))
    1.21