Open
Conversation
peterbarker
requested changes
Feb 23, 2026
Contributor
peterbarker
left a comment
There was a problem hiding this comment.
Should re-enable SMART_RTL_Repeat
| const uint16_t points_to_simplify = (path_points_count > _simplify.path_points_completed) ? (path_points_count - _simplify.path_points_completed) : 0 ; | ||
| const bool low_on_space = (_path_points_max - path_points_count) <= SMARTRTL_CLEANUP_START_MARGIN; | ||
|
|
||
| if(_prune.loops_count > 0 && low_on_space){ |
Contributor
There was a problem hiding this comment.
Suggested change
| if(_prune.loops_count > 0 && low_on_space){ | |
| if(_prune.loops_count > 0 && low_on_space) { |
| // To avoid this annoying math, a good-enough overestimate is ceil(SMARTRTL_POINTS_MAX*2.0f/3.0f) | ||
| #define SMARTRTL_SIMPLIFY_TIME_US 200 // maximum time (in microseconds) the simplification algorithm will run before returning | ||
| #define SMARTRTL_PRUNING_DELTA (_accuracy * 0.99) // How many meters apart must two points be, such that we can assume that there is no obstacle between them. must be smaller than _ACCURACY parameter | ||
| #define SMARTRTL_PRUNING_DELTA (SMARTRTL_ACCURACY_DEFAULT * 0.5) // How many meters apart must two points be, such that we can assume that there is no obstacle between them. must be smaller than _ACCURACY parameter |
Contributor
There was a problem hiding this comment.
Why this change? You're decoupling the pruning delta from the parameter which doesn't seem right.
| _prune.i = (path_points_count > 0) ? path_points_count - 1 : 0; | ||
| _prune.j = 0; | ||
| _prune.path_points_count = path_points_count; | ||
| _prune.path_points_completed = 0; |
Contributor
There was a problem hiding this comment.
Why is this important?
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.
Problem:
In Circle mode, SmartRTL deactivates because the path buffer fills faster than pruning can remove circular loops.
Changes:
Removed invalid SMARTRTL_SIMPLIFY_EPSILON macro and replaced it with _accuracy * 0.5f directly in detect_simplifications()
Proactively remove detected loops in routine_cleanup() when buffer space is low
Reset path_points_completed in restart_pruning() to rescan the full path for new loops
Testing:
Verified in SITL: Loiter → Arm → Takeoff → Circle → sim_speedup 100
SmartRTL stays active during circular flight.
Fixes #20716