From 2e328978ec9d24bc07e32d7dfc88303cdbb1783b Mon Sep 17 00:00:00 2001 From: Jien Cao Date: Mon, 22 Jul 2024 12:46:06 -0400 Subject: [PATCH] add handling for unexpected frame type for completeness --- spatialmath/base/animate.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spatialmath/base/animate.py b/spatialmath/base/animate.py index effcd52b..59b98887 100755 --- a/spatialmath/base/animate.py +++ b/spatialmath/base/animate.py @@ -214,10 +214,12 @@ def update(frame, animation): if isinstance(frame, float): # passed a single transform, interpolate it T = smb.trinterp(start=self.start, end=self.end, s=frame) - else: - # assume it is an SO(3) or SE(3) + elif isinstance(frame, NDArray): + # type is SO3Array or SE3Array when Animate.trajectory is not None T = frame - # ensure result is SE(3) + else: + # other types, attempt to convert + T = np.array(frame) if T.shape == (3, 3): T = smb.r2t(T)