Skip to content

Add clamping for SO3 and SE3#96

Merged
kevinzakka merged 3 commits intokevinzakka:mainfrom
adlarkin:pose_constraint_task
Jul 14, 2025
Merged

Add clamping for SO3 and SE3#96
kevinzakka merged 3 commits intokevinzakka:mainfrom
adlarkin:pose_constraint_task

Conversation

@adlarkin
Copy link
Contributor

@adlarkin adlarkin commented May 29, 2025

Closes #91

Add clamping to SO3 and SE3, which can be used to clamp pose targets for things like a frame task to emulate constraints on the end-effector.

@kevinzakka
Copy link
Owner

Hi @adlarkin, started an internship and am pretty slammed. Will review on the weekend!

@adlarkin
Copy link
Contributor Author

Hey @kevinzakka, just checking in - would you still be interested in giving this a look when you have the time?

@kevinzakka
Copy link
Owner

Hi @adlarkin, apologies for the delay! I've been at RSS demoing my work and attending the conference so got super busy. I’ll review this in the next few days. Thanks so much for your patience—and again, sorry for the wait!

@adlarkin
Copy link
Contributor Author

Thanks Kevin, no rush (it slipped my mind as well) - hope you enjoy RSS!

@stephane-caron
Copy link
Collaborator

stephane-caron commented Jul 10, 2025

Just two cents coming long after the initial PR 😊 but if I understand the task correctly it is the target pose that is constrained, with clamped translation and rotation? If so, maybe "ConstrainedPoseTask" or "ClampedPoseTask" could be more accurate names than "PoseConstraintTask"?

One concern with the expression "constraint task" is that it combines the words constraint and task, which in this context can also be used to distinguish between enforcing a (hard) constraint (QP equality constraint) versus a soft one (task expressed in the QP cost function).

@adlarkin
Copy link
Contributor Author

Hey @stephane-caron, thanks for chiming in! Your concern makes sense, I think it would be worth renaming this to ConstrainedPoseTask.

However, after taking another look at this, I think there is even a simpler approach - currently, the task proposed in this PR is the same as the RelativeFrameTask, but with clamping that is performed in the task's set_target method. To reduce code duplication, what if we instead added a clamp_pose method (or something similarly named) that users can call before calling the task's set_target? I see a few benefits here:

  • free function is simpler than another class
  • this free function can be used with any task (users just need to get the transform first, then call clamp_pose followed by set_target)

@kevinzakka thoughts on this? I can follow-up here with this change if you think it's worthwhile.

@adlarkin
Copy link
Contributor Author

adlarkin commented Jul 14, 2025

However, after taking another look at this, I think there is even a simpler approach - currently, the task proposed in this PR is the same as the RelativeFrameTask, but with clamping that is performed in the task's set_target method. To reduce code duplication, what if we instead added a clamp_pose method (or something similarly named) that users can call before calling the task's set_target?

I implemented this approach in 3976f0f. If we want to keep this new approach (it's a lot simpler!), I will update the PR title/description and mark #96 (comment) as resolved.

Copy link
Owner

@kevinzakka kevinzakka left a comment

Choose a reason for hiding this comment

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

Thank you @adlarkin, new changes look wonderful.

@adlarkin adlarkin changed the title Add PoseConstraintTask Add clamping for SO3 and SE3 Jul 14, 2025
@kevinzakka kevinzakka force-pushed the main branch 2 times, most recently from 06d9d2c to 0709d20 Compare July 14, 2025 15:21
@kevinzakka
Copy link
Owner

Hi @adlarkin, can you rebase to the latest main? Should fix the test errors.

@adlarkin adlarkin force-pushed the pose_constraint_task branch from 5153b3f to 0ee2f9e Compare July 14, 2025 17:47
@adlarkin
Copy link
Contributor Author

Done! Looks like all tests are passing now 🙂

@kevinzakka kevinzakka merged commit e575d77 into kevinzakka:main Jul 14, 2025
11 checks passed
@kevinzakka
Copy link
Owner

Woohoo, nice @adlarkin !

kevinzakka pushed a commit that referenced this pull request Dec 19, 2025
* PoseConstraintTask implementation

* make clamping a function for SO3 and SE3, remove PoseConstraintTask

* docstring format fix, typo
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.

Feature proposal - pose constraint task

3 participants