Skip to content

Commit 006d05a

Browse files
committed
cherry-pick euslisp/jskeus#380
1 parent 2e9ce57 commit 006d05a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

jsk_2016_01_baxter_apc/test/test-ik.l

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,33 @@
3636
(assert (< (norm (v- av1 av2)) 10))
3737
))
3838

39+
;; https://github.com/euslisp/jskeus/pull/380
40+
;; https://github.com/euslisp/jskeus/commit/9766a65d8346a939c9af89461691ccea334b2b7b#commitcomment-17593228
41+
(load "irteus/irtrobot.l")
42+
(defmethod robot-model
43+
(:calc-inverse-jacobian
44+
(jacobi &rest args
45+
&key
46+
((:manipulability-limit ml) 0.1)
47+
((:manipulability-gain mg) 0.001)
48+
weight debug-view
49+
ret wmat tmat umat umat2 mat-tmp
50+
mat-tmp-rc tmp-mrr tmp-mrr2
51+
&allow-other-keys)
52+
(let (jacobi# m m2 (k 0))
53+
;; m : manipulability
54+
(setq m (manipulability (if weight (m* jacobi (diagonal weight)) jacobi) tmp-mrr tmat)) ;; CHANGED
55+
(if (< m ml) (setq k (* mg (expt (- 1.0 (/ m ml)) 2))))
56+
(when (and debug-view (not (memq :no-message debug-view)))
57+
(warn "k :~7,3f (manipulability:~7,3f, gain:~7,3f, limit:~7,3f, len:~d)~%" k m mg ml (cadr (array-dimensions jacobi))))
58+
59+
;; calc weighted SR-inverse
60+
(setq jacobi# (sr-inverse jacobi k weight
61+
ret wmat tmat umat umat2 mat-tmp
62+
mat-tmp-rc tmp-mrr tmp-mrr2
63+
))
64+
jacobi#))
65+
)
3966
;; check why normal ik failed
4067
(deftest check-normal-ik-1 () ;; this uses exactry the same parameter with baxter-robot :inverse-kinematics in baxtereus/baxter-util.l
4168
(let (av1 av2)

0 commit comments

Comments
 (0)