Fix loss of first waypoint in upsample trajectory #416
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.
The current implementation of the upscale trajectory task fails to pass the first waypoint through to the output. This small patch fixes the problem. I have also adjusted the tests to account for the extra point in the outputs. I have tested this successfully with tesseract 0.20.2.
Demonstration of bug
I ran the following dummy trajectory through the
UpsampleTrajectoryTask
withlongest_valid_segment_length=0.5
:The current implementation returns the following. Note the loss of the 0 0 0 0 0 0 waypoint.
After applying my simple fix, the following is returned:
Why the bug occurs
When looping through the waypoints of a composite instruction, pairs of waypoints are examined and interpolated between if necessary. To avoid duplication of the endpoints, the loop at line 162 ignores the first point (since it was already added as the last point of the previous interpolation). In doing so, the very first waypoint is lost when
continue
is called at line 140. The fix is simply to add the very first waypoint to the resulting composite instruction.