Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factor out path joint-space jump check #2506

Merged
merged 7 commits into from
Nov 7, 2023

Conversation

marioprats
Copy link
Contributor

@marioprats marioprats commented Oct 31, 2023

Description

This change factors out the path joint-space jump detector of CartesianInterpolator into a separate function called hasJointSpaceJumps(), so that it can be used in a different context.

The new function returns an std::optional<int> with the path index where the jump happens, or nothing if there are no jumps.
The CartesianInterpolator::checkJointSpaceJump function is then updated to use the free function underneath, and truncate the path, etc, i.e., it keeps the same behavior.

In addition to this, there's two API-breaking changes:

  1. Remove the public CartesianInterpolator::checkRelativeJointSpaceJump and CartesianInterpolator::checkAbsoluteJointSpaceJump, since these can be easily achieved with the more general CartesianInterpolator::checkJointSpaceJump, therefore exposing a smaller API footprint.
  2. Update the JumpThreshold struct with named builder methods (disabled(), relative() and absolute()) instead of public constructors. This should be more readable and less error-prone.

Migrating old code to the new API should be straight-forward:

  • JumpThreshold() -> JumpThreshold::disabled()
  • JumpThreshold(2.0) -> JumpThreshold::relative(2.0)
  • JumpThreshold(1.0, 2.0) -> JumpThreshold::absolute(1.0, 2.0)

Finally, there's a few cosmetic changes in documentation and a semantic rename traj -> path, since these methods operate on paths (sequence of RobotState, as opposed to RobotTrajectory, which should take timing into account).

Closes #2272.

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

@marioprats marioprats requested a review from sjahr October 31, 2023 13:19
Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Attention: 33 lines in your changes are missing coverage. Please review.

Comparison is base (09019d2) 50.32% compared to head (6d379dc) 50.38%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2506      +/-   ##
==========================================
+ Coverage   50.32%   50.38%   +0.07%     
==========================================
  Files         391      391              
  Lines       31983    31992       +9     
==========================================
+ Hits        16091    16117      +26     
+ Misses      15892    15875      -17     
Files Coverage Δ
...nclude/moveit/robot_state/cartesian_interpolator.h 45.46% <0.00%> (-23.29%) ⬇️
...it_core/robot_state/src/cartesian_interpolator.cpp 35.53% <61.91%> (-0.70%) ⬇️

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marioprats
Copy link
Contributor Author

Ah, I think MTC is failing in CI because of the API change. Will probably need to keep the old JumpThreshold constructors public and mark them as deprecated.

Copy link
Contributor

@sjahr sjahr left a comment

Choose a reason for hiding this comment

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

Nice work! Just a couple of questions and nits and then this is ready to be merged

@marioprats marioprats requested a review from sjahr November 2, 2023 15:46
@marioprats marioprats requested a review from sjahr November 3, 2023 09:34
@henningkayser henningkayser merged commit f9ae31b into moveit:main Nov 7, 2023
12 checks passed
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.

Add utility function to check trajectory continuity
3 participants