From 2489966d184fb56e43f7c9dd2e38d98c341e5596 Mon Sep 17 00:00:00 2001 From: Naoki-Hiraoka Date: Sat, 12 Dec 2020 17:55:33 +0900 Subject: [PATCH] [pr2eus/pr2-ri-test-rimple.l] add unlimited joint test --- pr2eus/test/pr2-ri-test-simple-angle-vector.l | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/pr2eus/test/pr2-ri-test-simple-angle-vector.l b/pr2eus/test/pr2-ri-test-simple-angle-vector.l index 3da79b36..b23ff929 100644 --- a/pr2eus/test/pr2-ri-test-simple-angle-vector.l +++ b/pr2eus/test/pr2-ri-test-simple-angle-vector.l @@ -133,6 +133,48 @@ ) )) +(deftest test-angle-vector-unlimited-robot-interface + (let (msg) + (dolist (inc (list 10 -10)) + (do ((i 0.0 (incf i inc))) + ((if (> inc 0) (<= 1000 i) (>= -1000 i))) + (send *pr2* :reset-manip-pose) + (send *ri* :robot :reset-manip-pose) + (send *ri* :robot-interface-simulation-callback) ;; publish robot-state + (let ((initial-angle (elt (send *ri* :state :potentio-vector) 5))) + (send *pr2* :larm :elbow-r :joint-angle i) + (send-message *ri* robot-interface :angle-vector (send *pr2* :angle-vector) 500) + (send *ri* :wait-interpolation) + (setq msg + (format nil "initial ~A, *ri* ~A, *pr2* ~A ~A~%" + initial-angle + (elt (send *ri* :state :potentio-vector) 5) + (elt (send *pr2* :angle-vector) 5) + (eps<= (abs (- (elt (send *ri* :state :potentio-vector) 5) initial-angle)) 180.0 1.0))) + (warning-message 2 msg) + (assert (eps<= (abs (- (elt (send *ri* :state :potentio-vector) 5) initial-angle)) 180.0 1.0) msg)))))) + +(deftest test-angle-vector-unlimited-pr2-interface + (let (msg) + (dolist (inc (list 10 -10)) + (do ((i 0.0 (incf i inc))) + ((if (> inc 0) (<= 1000 i) (>= -1000 i))) + (send *pr2* :reset-manip-pose) + (send *ri* :robot :reset-manip-pose) + (send *ri* :robot-interface-simulation-callback) ;; publish robot-state + (let ((initial-angle (elt (send *ri* :state :potentio-vector) 5))) + (send *pr2* :larm :elbow-r :joint-angle i) + (send-message *ri* pr2-interface :angle-vector (send *pr2* :angle-vector) 500) + (send *ri* :wait-interpolation) + (setq msg + (format nil "initial ~A, *ri* ~A, *pr2* ~A ~A~%" + initial-angle + (elt (send *ri* :state :potentio-vector) 5) + (elt (send *pr2* :angle-vector) 5) + (eps= (elt (send *ri* :state :potentio-vector) 5) (elt (send *pr2* :angle-vector) 5) 1.0))) + (warning-message 2 msg) + (assert (eps= (elt (send *ri* :state :potentio-vector) 5) (elt (send *pr2* :angle-vector) 5) 1.0) msg)))))) + (run-all-tests) (exit)