Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions spatialmath/spline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Contributor

@bokorn-bdaii bokorn-bdaii Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some warning that this only works for order = [1,2]. Current system throws a value error for order != [0,1,2] but will fail on order 0 with a "ValueError: bad value to Twist constructor" error. We should check and throw errors for order != [1,2].

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for testing that

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:
Expand Down
Loading