Skip to content

Commit 6e752b5

Browse files
authored
Merge pull request #616 from k-okada/test_611
add test code for #611,
2 parents d8ddfa1 + c28b4ca commit 6e752b5

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

irteus/irtmodel.l

+13-12
Original file line numberDiff line numberDiff line change
@@ -2577,18 +2577,19 @@
25772577
(if (consp l) (deep-copy-list l) l))
25782578
lst)))
25792579
(setq print-args (deep-copy-list args)) ;; generate deep copy list for destructive operation
2580-
(dotimes (i (/ (length print-args) 2)) ;; escape list
2581-
(unless (eq (elt print-args (* 2 i)) :move-target) ;; neglect :move-target because move-target is fixed later
2582-
(escape-list print-args (+ 1 (* 2 i)))))
2583-
(dotimes (i (length print-args)) (escape-robot-link print-args i)) ;; escape robot link
2584-
(dotimes (j (count :move-target print-args)) ;; escape move-target
2585-
(if (setq i (position :move-target print-args :count (1+ j)))
2586-
(cond ((atom (elt print-args (+ i 1)))
2587-
(setf (elt print-args (+ i 1)) (get-move-target-transform-list (elt print-args (+ i 1)))))
2588-
(t
2589-
(setf (elt print-args (+ i 1))
2590-
(append '(list)
2591-
(mapcar #'(lambda (x) (get-move-target-transform-list x)) (elt print-args (+ i 1)))))))))
2580+
(dotimes (i (/ (length print-args) 2))
2581+
(if (not (eq (elt print-args (* 2 i)) :move-target))
2582+
;; escape args other than :move-target
2583+
(progn
2584+
(escape-list print-args (+ 1 (* 2 i))) ;; escape list
2585+
(escape-robot-link print-args (+ 1 (* 2 i)))) ;; escape robot link
2586+
;; escape :move-target
2587+
(cond ((atom (elt print-args (+ 1 (* 2 i))))
2588+
(setf (elt print-args (+ 1 (* 2 i))) (get-move-target-transform-list (elt print-args (+ 1 (* 2 i))))))
2589+
(t
2590+
(setf (elt print-args (+ 1 (* 2 i)))
2591+
(append '(list)
2592+
(mapcar #'(lambda (x) (get-move-target-transform-list x)) (elt print-args (+ 1 (* 2 i))))))))))
25922593
(setq command-init `(instance ,(send (class self) :name) :init)
25932594
command-setup `(progn (send r :newcoords (make-coords :4x4 ,(send self :4x4))) (mapc #'(lambda (j a) (send* j :joint-angle a ,joint-args)) (list . ,(mapcar #'(lambda (x) `(send r ,(intern (string-upcase x) *keyword-package*))) (send-all (remove-duplicates (append (send-all union-link-list :joint) joint-list)) :name))) ,(list 'quote av0)) (objects (list r))))
25942595
(setq command-args ;; append target-coords and print-args

irteus/test/test-irt-motion.l

+5
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,11 @@
12871287
)
12881288
)))
12891289

1290+
;; test for https://github.com/jsk-ros-pkg/jsk_pr2eus/issues/474, https://github.com/euslisp/jskeus/pull/611
1291+
(deftest segfault-with-move-target-within-link
1292+
(let ((robot (instance sample-robot :init)))
1293+
(assert (null (send robot :rarm :inverse-kinematics (make-coords) :move-target (send robot :link :rleg-link5))))))
1294+
12901295
(eval-when (load eval)
12911296
(run-all-tests)
12921297
(exit 0))

0 commit comments

Comments
 (0)