Skip to content

Commit 722fe99

Browse files
committed
[hrpsys_ros_bridge_tutorials][HIRONXJSK] Enable :self-collision-check on euslisp interface
1 parent 303e2bf commit 722fe99

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

hrpsys_ros_bridge_tutorials/euslisp/hironxjsk-utils.l

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,28 @@
9898
(:larm (setq arm :lhand)))
9999
(send self :hand-width arm 100)))
100100

101+
;; For proper :self-collision-check.
102+
;; Overwrite https://github.com/euslisp/jskeus/blob/1.2.5/irteus/irtmodel.l#L2670-L2684
103+
;; to exclude link pairs which always collide.
104+
;; Same method as https://github.com/jsk-ros-pkg/jsk_robot/pull/1026.
105+
(defmethod hironxjsk-robot
106+
(:collision-check-pairs
107+
(&key ((:links ls) (cons (car links) (all-child-links (car links)))))
108+
(let (pairs l neighbors
109+
(exclude-pairs
110+
(list (cons CHEST_JOINT0_Link_lk HEAD_JOINT1_Link_lk))))
111+
(while (setq l (pop ls))
112+
(setq neighbors (remove nil
113+
(append
114+
(send l :descendants)
115+
(send l :child-links)
116+
(list (send l :parent-link) (send l :parent)))))
117+
(dolist (l2 ls)
118+
(if (and (not (memq l2 neighbors))
119+
(not (member (cons l l2) exclude-pairs :test #'equal)))
120+
(push (cons l l2) pairs))))
121+
pairs)))
122+
101123
;; additional robot model description from camera_info
102124
;;
103125
(defun HIRONXJSK () (setq *HIRONXJSK* (instance HIRONXJSK-sensor-robot :init)))

0 commit comments

Comments
 (0)