Skip to content

refactor: increment multiple keypoints if needed#667

Open
trisceptre wants to merge 5 commits into
mainfrom
fusion-gen/interpolator-fix
Open

refactor: increment multiple keypoints if needed#667
trisceptre wants to merge 5 commits into
mainfrom
fusion-gen/interpolator-fix

Conversation

@trisceptre
Copy link
Copy Markdown
Contributor

Why are we doing this?

Not too relevant for this year, but incrementing by one keypoint at a time can cause breakage when there is an abundance of keypoints over a short period of time. Additionally, the maximum distance from chase points was changed to 3 so that we won't have to deal with any freezing logic in the interpolator for now.

Whats changing?

Questions/notes for reviewers

How this was tested

  • unit tests added
  • tested on robot

@trisceptre trisceptre requested a review from a team as a code owner March 28, 2026 20:53
Copilot AI review requested due to automatic review settings March 28, 2026 20:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates SimpleTimeInterpolator to better handle scenarios where the interpolator needs to advance across multiple keypoints within a single cycle, and relaxes the chase-point “freeze” threshold to reduce freezing behavior.

Changes:

  • Increase default maximumDistanceFromChasePointInMeters from 0.3 to 3.
  • Make InterpolationResult a static nested class and simplify empty-list checks with isEmpty().
  • Replace single-step keypoint advancement with a loop that can advance across multiple keypoints in one call.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/xbot/common/trajectory/SimpleTimeInterpolator.java
Comment thread src/main/java/xbot/common/trajectory/SimpleTimeInterpolator.java Outdated
Comment thread src/main/java/xbot/common/trajectory/SimpleTimeInterpolator.java Outdated
@Team488 Team488 deleted a comment from Copilot AI Mar 28, 2026
@trisceptre trisceptre changed the title fix: increment multiple keypoints if needed refactor: increment multiple keypoints if needed May 22, 2026
// If the fraction is above 1, it's time to set a new baseline point and start LERPing on the next point
if (lerpFraction >= 1 && index < keyPoints.size()-1) {
// What was our target now becomes our baseline.
while (index < keyPoints.size() - 1) {
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.

⭐ are there any unit tests that could be added to help validate this logic?

log.debug("Baseline is now " + baseline.getTranslation2d()
+ " and target is now " + targetKeyPoint.getTranslation2d());

log.info("Advancing to next keypoint, new baseline is {} and new target is {}", baseline.getTranslation2d(), targetKeyPoint.getTranslation2d());
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.

❔ would we ever have so many keypoints that this logline would become spammy?

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