From 99f5ca8d1dc8e1ef7d659d5d404b33f0e5efb8d5 Mon Sep 17 00:00:00 2001 From: Shun Hasegawa Date: Fri, 14 Oct 2022 22:38:55 +0900 Subject: [PATCH 1/3] [irteus] Add test of passing integer time-list to interpolator cf. https://github.com/euslisp/jskeus/pull/625 --- irteus/test/interpolator.l | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/irteus/test/interpolator.l b/irteus/test/interpolator.l index 51d23e06..1e128015 100644 --- a/irteus/test/interpolator.l +++ b/irteus/test/interpolator.l @@ -239,6 +239,15 @@ )) )) +;; https://github.com/euslisp/jskeus/pull/625 +(defun test-interpolators-625 + (&optional (ip-class linear-interpolator)) + (let ((ip (instance ip-class :init))) + (send ip :reset :position-list (list #f(1 2 3) #f(3 4 5) #f(1 2 3)) :time-list (list 1000 1800)) + (send ip :start-interpolation) + (send ip :pass-time 200) + (assert (send ip :interpolatingp)))) + (deftest test-linear-interpolator () (let ((res (test-interpolators linear-interpolator))))) @@ -257,6 +266,12 @@ (deftest test-minjerk-absolute-interpolator-457-0005 () (let ((res (test-interpolators-457 minjerk-interpolator 0.0005))))) +(deftest test-linear-interpolator-625 () + (let ((res (test-interpolators-625 linear-interpolator))))) + +(deftest test-minjerk-interpolator-625 () + (let ((res (test-interpolators-625 minjerk-interpolator))))) + #| (load "~/prog/euslib/jsk/gnuplotlib.l") From 729aefa46224c5d64ec9401dacabc25d09ad767e Mon Sep 17 00:00:00 2001 From: Shun Hasegawa Date: Fri, 14 Oct 2022 21:17:33 +0900 Subject: [PATCH 2/3] [irteus/irtutil.l] Enable to pass integer time-list to interpolator --- irteus/irtutil.l | 2 ++ 1 file changed, 2 insertions(+) diff --git a/irteus/irtutil.l b/irteus/irtutil.l index 2e909d56..d9499ace 100644 --- a/irteus/irtutil.l +++ b/irteus/irtutil.l @@ -265,6 +265,8 @@ time-list: list of time from start for each control point, time in first contrall point is zero, so length of this list is length of control point minus 1" (setq position-list pl) (setq time-list tl) + (dotimes (i (length time-list)) + (setf (elt time-list i) (float (elt time-list i)))) ;; to use compiled eps> properly (see https://github.com/euslisp/EusLisp/issues/406) (if (/= (length position-list) (1+ (length time-list))) (warning-message 1 "length of position-list must be length of time-list + 1")) (setq time 0.0) From 09a2b5504eab3bd2e7531c0845607e8a6da47b31 Mon Sep 17 00:00:00 2001 From: Shun Hasegawa Date: Mon, 17 Oct 2022 13:59:36 +0900 Subject: [PATCH 3/3] [irteus/irtutil.l] Optimize float conversion of time-list in interpolator Reflect @Affonso-Gui's offline comment --- irteus/irtutil.l | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/irteus/irtutil.l b/irteus/irtutil.l index d9499ace..7ce01ca1 100644 --- a/irteus/irtutil.l +++ b/irteus/irtutil.l @@ -264,9 +264,7 @@ position-list: list of control point time-list: list of time from start for each control point, time in first contrall point is zero, so length of this list is length of control point minus 1" (setq position-list pl) - (setq time-list tl) - (dotimes (i (length time-list)) - (setf (elt time-list i) (float (elt time-list i)))) ;; to use compiled eps> properly (see https://github.com/euslisp/EusLisp/issues/406) + (setq time-list (mapcar #'float tl)) ;; float conversion is for compiled eps> (see https://github.com/euslisp/EusLisp/issues/406) (if (/= (length position-list) (1+ (length time-list))) (warning-message 1 "length of position-list must be length of time-list + 1")) (setq time 0.0)