|
726 | 726 | )
|
727 | 727 | ))
|
728 | 728 |
|
| 729 | +;; test for static balance point |
| 730 | +(defun fullbody-ik-with-forces (robot &key (debug-view :no-message)) |
| 731 | + (send robot :newcoords (make-coords)) |
| 732 | + (send robot :reset-pose) |
| 733 | + (send robot :fix-leg-to-coords (make-coords)) |
| 734 | + (send robot :legs :move-end-pos (float-vector 0 0 50)) |
| 735 | + (send robot :fix-leg-to-coords (make-coords)) |
| 736 | + (objects (list robot)) |
| 737 | + (let* ((centroid-thre 10) |
| 738 | + (result |
| 739 | + (send robot :fullbody-inverse-kinematics |
| 740 | + (list (send robot :rleg :end-coords :copy-worldcoords) |
| 741 | + (send robot :lleg :end-coords :copy-worldcoords) |
| 742 | + (make-coords :pos #f(150 -300 600)) |
| 743 | + (make-coords :pos #f(150 300 600))) |
| 744 | + :move-target (mapcar #'(lambda (x) |
| 745 | + (send robot x :end-coords)) |
| 746 | + (list :rleg :lleg :rarm :larm)) |
| 747 | + :link-list (mapcar #'(lambda (x) |
| 748 | + (send robot :link-list (send robot x :end-coords :parent))) |
| 749 | + (list :rleg :lleg :rarm :larm)) |
| 750 | + :centroid-thre centroid-thre |
| 751 | + :centroid-offset-func #'(lambda () (send robot :calc-static-balance-point :force-list (list #f(10 20 0) #f(25 20 0)))) |
| 752 | + :debug-view debug-view))) |
| 753 | + (and result |
| 754 | + (> centroid-thre (distance (apply #'midpoint 0.5 (send robot :legs :end-coords :worldpos)) |
| 755 | + (send robot :calc-static-balance-point :force-list (list #f(10 20 0) #f(25 20 0)))))) |
| 756 | + )) |
| 757 | + |
729 | 758 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
730 | 759 | ;; unit tests
|
731 | 760 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
795 | 824 | (assert
|
796 | 825 | (test-self-collision-check-IK)))
|
797 | 826 |
|
| 827 | +(deftest test-fullbody-ik-with-forces-samplerobot |
| 828 | + (assert |
| 829 | + (fullbody-ik-with-forces *sample-robot*))) |
| 830 | + |
798 | 831 | (run-all-tests)
|
799 | 832 | (exit 0)
|
0 commit comments