-
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
Fix max-hagl restriction to position/altitude control #23667
Open
haumarco
wants to merge
4
commits into
main
Choose a base branch
from
max_hagl_control
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+84
−43
Conversation
This file contains 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
haumarco
force-pushed
the
max_hagl_control
branch
from
September 11, 2024 08:55
c8c6203
to
567daf5
Compare
bresch
requested changes
Sep 11, 2024
src/modules/flight_mode_manager/tasks/ManualAcceleration/FlightTaskManualAcceleration.cpp
Outdated
Show resolved
Hide resolved
bresch
requested changes
Nov 14, 2024
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.
Overall good, just a couple of comments
src/modules/flight_mode_manager/tasks/ManualAcceleration/FlightTaskManualAcceleration.cpp
Outdated
Show resolved
Hide resolved
src/modules/flight_mode_manager/tasks/ManualAcceleration/FlightTaskManualAcceleration.cpp
Outdated
Show resolved
Hide resolved
src/modules/flight_mode_manager/tasks/ManualAcceleration/FlightTaskManualAcceleration.cpp
Outdated
Show resolved
Hide resolved
src/modules/flight_mode_manager/tasks/ManualAcceleration/FlightTaskManualAcceleration.cpp
Outdated
Show resolved
Hide resolved
src/modules/flight_mode_manager/tasks/ManualAltitude/FlightTaskManualAltitude.cpp
Outdated
Show resolved
Hide resolved
src/modules/flight_mode_manager/tasks/ManualAltitude/FlightTaskManualAltitude.hpp
Outdated
Show resolved
Hide resolved
haumarco
force-pushed
the
max_hagl_control
branch
from
November 18, 2024 09:35
f0d0072
to
5347c12
Compare
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 560 byte (0.03 %)]
px4_fmu-v6x [Total VM Diff: 552 byte (0.03 %)]
Updated: 2025-01-10T13:24:22 |
haumarco
force-pushed
the
max_hagl_control
branch
from
January 10, 2025 13:18
5347c12
to
09da49e
Compare
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.
Currently, when flying with only optical flow in position mode, you can easily surpass the max HAGL by continuously pushing the throttle up. The vehicle decelerates until it eventually exceeds the limit. At that point, we immediately lose optical flow measurements (when above the max height), and consequently, the HAGL max parameter is no longer set.
I modified the controller to limit the altitude to 1 meter (or 10%) below the actual max height limit. This ensures that even after approaching the limit, optical flow remains active, and the controller tries to correct the altitude.
Previously, the HAGL max also influenced the controller in altitude mode, which was undesirable when using a range sensor or barometer. To resolve this, I split the HAGL max field of the local position message into hagl_max_z (for vertical control) and hagl_max_xy (for horizontal position control).
When flying at max_hgt_xy, the platform descends if the terrain elevation decreases, in order to maintain a valid local position estimate. Additionally, when flying near the hagl_max_xy limit, I adjust the maximum horizontal velocity to reduce the risk of losing optical flow due to rapid elevation changes.
To avoid adding new subscribers, the hagl_max controller setting is still handled in the estimator.
In the FlightTaskManAcc, I now set the max_dist_to_ground of the FlightTaskManAlt because it depends on whether ManAcc is running. Since ManAlt cannot directly check if ManAcc is running (as it's a cascaded controller), this adjustment was necessary in order to keep it simple.
Please also give some feedback if this behavior fits what a typical user would expect.