From 0117e35576b6a6ef40f6d77cce17df41c151d392 Mon Sep 17 00:00:00 2001 From: Mark Yeatman Date: Thu, 20 Nov 2025 16:44:09 -0500 Subject: [PATCH] Allow higher order spline derivatives. --- spatialmath/spline.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spatialmath/spline.py b/spatialmath/spline.py index 7f849442..c2b9524b 100644 --- a/spatialmath/spline.py +++ b/spatialmath/spline.py @@ -133,12 +133,12 @@ def __call__(self, t: float) -> SE3: """ return SE3.Rt(t=self.spline_xyz(t), R=self.spline_so3(t).as_matrix()) - def derivative(self, t: float) -> Twist3: - linear_vel = self.spline_xyz.derivative()(t) - angular_vel = self.spline_so3( - t, 1 + def derivative(self, t: float, order: int = 1) -> Twist3: + linear = self.spline_xyz.derivative(order)(t) + angular = self.spline_so3( + t, order ) # 1 is angular rate, 2 is angular acceleration - return Twist3(linear_vel, angular_vel) + return Twist3(linear, angular) class SplineFit: