-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
PositionSmoothing: fix corner altitude bug #22331
Conversation
During a round corner the L1 distance calculation was only done in 2D and the z-axis coordinate was directly coming from the next waypoint. This lead to an unpredictable altitude profile between two waypoints. Sometimes almost all altitude difference was already covered during the turn instead of going diagonally.
@bresch ready for final pass :) |
Hi @MaEtUgR This bug occurs only in main, v1.14, or also occurs in v1.13.3 too? thank you. |
@saengphet I actually just minutes ago tried to find this out but it's not so clear to me yet. The part I changed does the same thing since rounded turns were introduced but possibly it was not a problem before other changes. I'd need to dig more. 1.14 is for sure the same and I'll backport my fix once it's merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, that's a pretty straightforward fix: 2D -> 3D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a SITL test and had a fly-away
https://logs.px4.io/plot_app?log=0d5aae66-628f-4e0f-8a28-426e2b85bcdb
Is it reproducible? Can you share the plan file that produces it? |
Same plan works fine for me. On to debugging 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to repeat the issue on main, so it's unrelated to this PR
oof - alrighty - can you make an issue so we track this newfound bug @bresch ? |
Just for completeness, the "flyaway" i had in simulation was due to a landing approach that I did set for a VTOL plane simulation earlier. |
I checked the 2D case which is the one where the altitude is not valid:
Following findings: I don't see how it can ever be the path taken if not by my test code because QGC requires every waypoint to have an altitude, navigator puts altitudes to the waypoints and the flight task puts at least the current altitude to every waypoint. In case there was a valid code path my change would do the same calculation as before iff the z coordinate is really the same altitude for the current position and waypoint. I expect this case to get obsolete in the next refactor. |
Solved Problem
We got multiple reports that the altitude profile between two waypoints is not a diagonal line but changes altitude much quicker when leaving the previous waypoint and getting much flatter after that.
During a round corner the L1 distance calculation
was only done in 2D and the z-axis coordinate
was directly coming from the next waypoint.
This lead to an unpredictable altitude profile
between two waypoints. Sometimes almost all
altitude difference was already covered during
the turn instead of going diagonally.
Fixes #{Github issue ID}
Solution
Changelog Entry
Test coverage
Simulation testing procedure:
PX4_SIM_SPEED_FACTOR=100 make px4_sitl jmavsim
I still need to verify the 2D only case with no valid altitude works as expected.
Context
Before: https://logs.px4.io/3d?log=45c8f43e-32e7-4c7f-ab30-975e1c8aa32b
After: https://logs.px4.io/3d?log=17dd1c3e-bd5e-46b0-abad-3bba6c517e2f