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:

@bokorn-bdaii bokorn-bdaii Nov 20, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Careful with semantics —Twist3 represents finite displacement (pose logarithm) rather than instantaneous velocity. Passing (v,ω) directly makes methods like .exp() implicitly bake in Δt=1 s. We should scale by dt or use a dedicated velocity class/structure.

This will work but the usage doesn't match with the documentation for the class. Perhaps need a VelocityTwist3 class.

Are you simply looking for a container to hold (v,ω) like a ROS Twist message?



class SplineFit:
Expand Down
Loading