[jtc] Improve trajectory sampling efficiency (backport #1297)#1358
Merged
christophfroehlich merged 2 commits intoironfrom Nov 11, 2024
Merged
[jtc] Improve trajectory sampling efficiency (backport #1297)#1358christophfroehlich merged 2 commits intoironfrom
christophfroehlich merged 2 commits intoironfrom
Conversation
Member
|
CI fails because of #1354 |
--------- Co-authored-by: Christoph Fröhlich <christophfroehlich@users.noreply.github.com> Co-authored-by: Bence Magyar <bence.magyar.robotics@gmail.com> (cherry picked from commit b0391e2)
9b0e7f9 to
2c24549
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## iron #1358 +/- ##
==========================================
- Coverage 65.08% 64.94% -0.15%
==========================================
Files 107 107
Lines 12191 12283 +92
Branches 7498 7576 +78
==========================================
+ Hits 7935 7977 +42
+ Misses 1540 1534 -6
- Partials 2716 2772 +56
Flags with carried forward coverage won't be shown. Click here to find out more.
|
christophfroehlich
approved these changes
Nov 11, 2024
saikishor
approved these changes
Nov 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses the increasing effort required in
Trajectory::sample()raised in #1293 by exploiting the monotonically increasing access time for any trajectory. Instead of scanning through the complete trajectory to find the relevant trajectory points for the current sampling time, theTrajectoryclass keeps track of the last accessed index and only searches from there on. This supersedes the proposed binary search in #1294 and is based on #474.Based on the requests in #474, i added checks for the new trajectory state to existing tests and added a new test to make sure that the index is correctly reset when calling
Trajectory::update(). I verified that this indeed solves the problem by re-running the trajectory from #1293 and again plotting the periods betweenwrite()calls in my hardware interface:The upper plot shows the progression of the period before this change, the lower one the behavior wtih this PR applied. The large spikes at the beginning and end are the start and end of the trajectory, the spikes in the middle are probably a result of me testing this on my normal laptop without RT kernel and doing some things on the side.
This is an automatic backport of pull request #1297 done by Mergify.