Skip to content

Commit 05048ea

Browse files
committed
[test-irtmotion.l]fix test-go-pos-params->footstep-list-test
1 parent 63ad220 commit 05048ea

File tree

1 file changed

+52
-21
lines changed

1 file changed

+52
-21
lines changed

irteus/test/test-irt-motion.l

Lines changed: 52 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,21 @@
915915
0 5))))
916916
))
917917

918+
;;test for go-pos-params->footstep-list
919+
(defun test-go-pos-params->footstep-list (robot x y th)
920+
(let* ((sc (send (send robot :foot-midcoords) :copy-worldcoords))
921+
(tc (send (make-coords :pos (float-vector x y 0) :rpy (float-vector (deg2rad th) 0 0)) :transform sc :world))
922+
(footstep-list (send robot :go-pos-params->footstep-list x y th))
923+
(gc (midcoords 0.5 (car (reverse footstep-list)) (cadr (reverse footstep-list))))
924+
(diff (send tc :transformation gc :local))
925+
(tran (send sc :transformation gc :local)))
926+
(and
927+
(eps= (elt (send diff :pos) 0) 0.0)
928+
(eps= (elt (send diff :pos) 1) 0.0)
929+
(eps= (rad2deg (elt (car (rpy-angle (send diff :rot))) 0)) 0.0))
930+
)
931+
)
932+
918933
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
919934
;; unit tests
920935
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1042,27 +1057,43 @@
10421057
(fullbody-ik-with-look-at robot :debug-view nil))
10431058
))
10441059

1045-
(deftest test-go-pos-params->footstep-list
1046-
(let ((testfunc #'(lambda (x y th)
1047-
(let* ((sc (send (send *sample-robot* :foot-midcoords) :copy-worldcoords))
1048-
(tc (send (make-coords :pos (float-vector x y 0) :rpy (float-vector (deg2rad th) 0 0)) :transform sc :world))
1049-
(footstep-list (send *sample-robot* :go-pos-params->footstep-list x y th))
1050-
(gc (midcoords 0.5 (car (reverse footstep-list)) (cadr (reverse footstep-list))))
1051-
(diff (send tc :transformation gc :local))
1052-
(tran (send sc :transformation gc :local)))
1053-
(assert (and
1054-
(eps= (elt (send diff :pos) 0) 0.0)
1055-
(eps= (elt (send diff :pos) 1) 0.0)
1056-
(eps= (rad2deg (elt (car (rpy-angle (send diff :rot))) 0)) 0.0))
1057-
(format nil "trans: input(~A ~A ~A) result(~A ~A ~A)" x y th (elt (send tran :pos) 0) (elt (send tran :pos) 1) (rad2deg (elt (car (rpy-angle (send tran :rot))) 0))))))))
1058-
(send *sample-robot* :reset-pose)
1059-
(send *sample-robot* :fix-leg-to-coords (make-coords))
1060-
(funcall testfunc 500 150 45)
1061-
(funcall testfunc -500 150 180)
1062-
(send *sample-robot* :fix-leg-to-coords (make-coords :rpy (float-vector pi/2 0 0)))
1063-
(funcall testfunc 0 -150 135)
1064-
(send *sample-robot* :fix-leg-to-coords (make-coords :rpy (float-vector pi 0 0)))
1065-
(funcall testfunc 500 150 90)))
1060+
(deftest test-go-pos-params->footstep-list-test
1061+
(send *sample-robot* :reset-pose)
1062+
(send *sample-robot* :fix-leg-to-coords (make-coords))
1063+
(assert
1064+
(test-go-pos-params->footstep-list *sample-robot* 500 0 0))
1065+
(send *sample-robot* :fix-leg-to-coords (make-coords))
1066+
(assert
1067+
(test-go-pos-params->footstep-list *sample-robot* 0 150 0))
1068+
(send *sample-robot* :fix-leg-to-coords (make-coords))
1069+
(assert
1070+
(test-go-pos-params->footstep-list *sample-robot* 0 -150 0))
1071+
(send *sample-robot* :fix-leg-to-coords (make-coords))
1072+
(assert
1073+
(test-go-pos-params->footstep-list *sample-robot* 0 0 45))
1074+
(send *sample-robot* :fix-leg-to-coords (make-coords))
1075+
(assert
1076+
(test-go-pos-params->footstep-list *sample-robot* 0 0 -45))
1077+
(send *sample-robot* :fix-leg-to-coords (make-coords))
1078+
(assert
1079+
(test-go-pos-params->footstep-list *sample-robot* 0 0 180))
1080+
(send *sample-robot* :fix-leg-to-coords (make-coords))
1081+
(assert
1082+
(test-go-pos-params->footstep-list *sample-robot* 0 0 -180))
1083+
(send *sample-robot* :fix-leg-to-coords (make-coords))
1084+
(assert
1085+
(test-go-pos-params->footstep-list *sample-robot* 500 150 45))
1086+
(send *sample-robot* :fix-leg-to-coords (make-coords :rpy (float-vector pi/2 0 0)))
1087+
(assert
1088+
(test-go-pos-params->footstep-list *sample-robot* 500 150 45))
1089+
(send *sample-robot* :fix-leg-to-coords (make-coords :rpy (float-vector -pi/2 0 0)))
1090+
(assert
1091+
(test-go-pos-params->footstep-list *sample-robot* 500 150 45))
1092+
1093+
(send *sample-robot* :fix-leg-to-coords (make-coords :rpy (float-vector pi 0 0)))
1094+
(assert
1095+
(test-go-pos-params->footstep-list *sample-robot* 500 150 45))
1096+
)
10661097

10671098
;; Test calling calc-walk-pattern-from-footstep-list N times
10681099
;; This test is for bug reported in https://github.com/euslisp/jskeus/issues/286.

0 commit comments

Comments
 (0)