OSDN Git Service

[1] The function L->accer was bugfixed.
authorU-tackya-PC\tackya <yammouch@users.sourceforge.jp>
Tue, 6 Mar 2012 13:12:03 +0000 (22:12 +0900)
committerU-tackya-PC\tackya <yammouch@users.sourceforge.jp>
Tue, 6 Mar 2012 13:12:03 +0000 (22:12 +0900)
dynamics/src/math.clj

index 9032c45..1139611 100755 (executable)
@@ -74,7 +74,7 @@
 (defn tfassoc [x idxs func]
   (if (empty? idxs)
     (func x)
-    (assoc x
+    (assoc (vec x)
            (inc (first idxs))
            (tfassoc (nth x (inc (first idxs)))
                     (rest idxs)
 ; A = (d2 d2 L)^(-1) (d1 L - d0 d2 L - (d1 d2 L)I2)
 (defn L->accer [L]
   (fn [x] ; x -> [up t q qdot]
-    (println x)
-    (println (partial-val L [] x))
-    (t* (tinv (partial-val L [2 2] x))
+    (t* (tinv (partial-val (fn [x] (partial-val L [2] x))
+                           [2] x))
         (t- (partial-val L [1] x)
-            (partial-val L [2 0] x)
-            (t* (partial-val L [2 1] x)
+            (partial-val (fn [x] (partial-val L [2] x))
+                         [0] x)
+            (t* (partial-val (fn [x] (partial-val L [2] x))
+                             [1] x)
                 (nth x 3)
                 )))))
 
 (def *h* 0.02)
 
 (defn next-iter [phys xis]
-  (println phys)
-  (println xis)
   (let [jaco (partial-val phys [] xis)
-        _ (println jaco)
         lhs (m-m (i-mat (dec (count xis)))
                  (s*m *h*
                       (vec (apply map vector ; transpose