Skip to content

Allow higher order spline derivatives. - #176

Open
myeatman-bdai wants to merge 2 commits into
masterfrom
spline-derivatives
Open

Allow higher order spline derivatives.#176
myeatman-bdai wants to merge 2 commits into
masterfrom
spline-derivatives

Conversation

@myeatman-bdai

Copy link
Copy Markdown
Collaborator

Calculate higher order spline derivatives for the InterpSplineSE3 class.

@bokorn-bdaii bokorn-bdaii left a comment

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.

Looks good. Can you add the derivative computation to the unit tests and add a docstring to the derivative function.

Comment thread spatialmath/spline.py
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

Comment thread spatialmath/spline.py
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?

@petercorke petercorke left a comment

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.

This method has no docstring and no test. The whole spline module is very light on docstrings, and the docstrings don't conform to the reST standard used through the rest of spatialmath. They are inconsistent 'google style' docstrings.

Agree with the other reviewer that there should be check on order.

Some methods have zero test coverage.

This is a useful functionality for the package but there's a bit of tech debt.

@petercorke

Copy link
Copy Markdown
Collaborator

@jbarry-bdai this PR is almost trivial and has no risk. But the spline implementation needs work on test coverage and docstring formatting. I'm also surprised at the return value being a Twist3 object and not sure whether that makes sense mathematically or whether the author just wanted a container for linear+angular velocity.

Not sure how to resolve this if Mark has left. I'd recommend approving it, but we should start a tech debt list somewhere. In other packages I've using Issues tagged 'tech-debt'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants