|
915 | 915 | 0 5)))) |
916 | 916 | )) |
917 | 917 |
|
| 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 | + ) |
| 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 | + |
918 | 933 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
919 | 934 | ;; unit tests |
920 | 935 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
1042 | 1057 | (fullbody-ik-with-look-at robot :debug-view nil)) |
1043 | 1058 | )) |
1044 | 1059 |
|
| 1060 | +(deftest test-go-pos-params->footstep-list-test_0_500_0_0 |
| 1061 | + (send *sample-robot* :reset-pose) |
| 1062 | + (send *sample-robot* :fix-leg-to-coords (make-coords)) |
| 1063 | + (assert (test-go-pos-params->footstep-list *sample-robot* 500 0 0))) |
| 1064 | + |
| 1065 | +(deftest test-go-pos-params->footstep-list-test_0_0_150_0 |
| 1066 | + (send *sample-robot* :reset-pose) |
| 1067 | + (send *sample-robot* :fix-leg-to-coords (make-coords)) |
| 1068 | + (assert (test-go-pos-params->footstep-list *sample-robot* 0 150 0))) |
| 1069 | + |
| 1070 | +(deftest test-go-pos-params->footstep-list-test_0_0_-150_0 |
| 1071 | + (send *sample-robot* :reset-pose) |
| 1072 | + (send *sample-robot* :fix-leg-to-coords (make-coords)) |
| 1073 | + (assert (test-go-pos-params->footstep-list *sample-robot* 0 -150 0))) |
| 1074 | + |
| 1075 | +(deftest test-go-pos-params->footstep-list-test_0_0_0_45 |
| 1076 | + (send *sample-robot* :reset-pose) |
| 1077 | + (send *sample-robot* :fix-leg-to-coords (make-coords)) |
| 1078 | + (assert (test-go-pos-params->footstep-list *sample-robot* 0 0 45))) |
| 1079 | + |
| 1080 | +(deftest test-go-pos-params->footstep-list-test_0_0_0_-45 |
| 1081 | + (send *sample-robot* :reset-pose) |
| 1082 | + (send *sample-robot* :fix-leg-to-coords (make-coords)) |
| 1083 | + (assert (test-go-pos-params->footstep-list *sample-robot* 0 0 -45))) |
| 1084 | + |
| 1085 | +(deftest test-go-pos-params->footstep-list-test_0_0_0_180 |
| 1086 | + (send *sample-robot* :reset-pose) |
| 1087 | + (send *sample-robot* :fix-leg-to-coords (make-coords)) |
| 1088 | + (assert (test-go-pos-params->footstep-list *sample-robot* 0 0 180))) |
| 1089 | + |
| 1090 | +(deftest test-go-pos-params->footstep-list-test_0_0_0_-180 |
| 1091 | + (send *sample-robot* :reset-pose) |
| 1092 | + (send *sample-robot* :fix-leg-to-coords (make-coords)) |
| 1093 | + (assert (test-go-pos-params->footstep-list *sample-robot* 0 0 -180))) |
| 1094 | + |
| 1095 | +(deftest test-go-pos-params->footstep-list-test_0_500_150_45 |
| 1096 | + (send *sample-robot* :reset-pose) |
| 1097 | + (send *sample-robot* :fix-leg-to-coords (make-coords)) |
| 1098 | + (assert (test-go-pos-params->footstep-list *sample-robot* 500 150 45))) |
| 1099 | + |
| 1100 | +(deftest test-go-pos-params->footstep-list-test_pi/2_500_150_45 |
| 1101 | + (send *sample-robot* :reset-pose) |
| 1102 | + (send *sample-robot* :fix-leg-to-coords (make-coords :rpy (float-vector pi/2 0 0))) |
| 1103 | + (assert (test-go-pos-params->footstep-list *sample-robot* 500 150 45))) |
| 1104 | + |
| 1105 | +(deftest test-go-pos-params->footstep-list-test_-pi/2_500_150_45 |
| 1106 | + (send *sample-robot* :reset-pose) |
| 1107 | + (send *sample-robot* :fix-leg-to-coords (make-coords :rpy (float-vector -pi/2 0 0))) |
| 1108 | + (assert (test-go-pos-params->footstep-list *sample-robot* 500 150 45))) |
| 1109 | + |
| 1110 | +(deftest test-go-pos-params->footstep-list-test_pi_500_150_45 |
| 1111 | + (send *sample-robot* :reset-pose) |
| 1112 | + (send *sample-robot* :fix-leg-to-coords (make-coords :rpy (float-vector pi 0 0))) |
| 1113 | + (assert (test-go-pos-params->footstep-list *sample-robot* 500 150 45))) |
1045 | 1114 |
|
1046 | 1115 | ;; Test calling calc-walk-pattern-from-footstep-list N times |
1047 | 1116 | ;; This test is for bug reported in https://github.com/euslisp/jskeus/issues/286. |
|
0 commit comments