File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 23962396 )
23972397 pairs))
23982398 (:self-collision-check
2399- (&key (mode :all ) (pairs (send self :collision-check-pairs )) (collision-func ' pqp-collision-check))
2399+ (&key (mode :all ) (pairs (send self :collision-check-pairs )) (collision-func ' pqp-collision-check) (distance-func ' pqp-collision-distance) (fat nil ))
2400+ " calculate self collision chaeck
2401+ :mode (:all or :first) ; returns first collided link pair of all collided link pair
2402+ :pairs (list (cons <link1> <link2>) ....) ; linke pair to be checked
2403+ :fat (number) if number is set, any link pair that has smaller distance than this fat threshold will regard as collided"
24002404 (let ((cpairs) (col-count 0 ))
24012405 (dolist (p pairs)
2402- (let ((colp (/= (funcall collision-func (car p) (cdr p)) 0 )))
2406+ (let ((colp
2407+ (cond ((numberp fat)
2408+ (< (car (funcall distance-func (car p) (cdr p) :fat fat)) fat))
2409+ (t
2410+ (/= (funcall collision-func (car p) (cdr p)) 0 )))))
24032411 (when colp
24042412 (incf col-count)
24052413 (if (eq mode :first )
Original file line number Diff line number Diff line change 6868 ))
6969 ))
7070
71+ (deftest test-collision-check
72+ (let ()
73+ (send *robot* :reset-pose )
74+ (assert (null (send *robot* :self-collision-check :pairs (list (cons (send *robot* :link :lleg-link5 ) (send *robot* :link :rleg-link5 ))))) " this is saf pose" )
75+ (assert (null (send *robot* :self-collision-check :pairs (list (cons (send *robot* :link :lleg-link5 ) (send *robot* :link :rleg-link5 ))) :fat 49 )) " distance value is 50 > 49" )
76+ (assert (send *robot* :self-collision-check :pairs (list (cons (send *robot* :link :lleg-link5 ) (send *robot* :link :rleg-link5 ))) :fat 51 ) " closest distance is 50 < 51" )
77+ ))
78+
7179
7280(run-all-tests)
7381(exit)
You can’t perform that action at this time.
0 commit comments