-
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
MPC: Survey: Added a turning radius to altitude changes in FlightModeAuto #23971
Conversation
FLASH Analysispx4_fmu-v5x
px4_fmu-v6x
Updated: 2024-11-29T10:57:58 |
2bfb198
to
42d169e
Compare
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.
Thanks for looking into it! We also tested on the real vehicle and it solves the issue.
I allowed myself to commit some refactoring which should not change the result.
We should really opt for a 3D solution of this whole calculation because it seems to add duplication make it hard to follow all the steps. But I agree it's a bigger change we need to tackle. I see the vertical calculation is now analogous to
PX4-Autopilot/src/lib/motion_planning/TrajectoryConstraints.hpp
Lines 87 to 92 in ab32001
const float alpha = acosf(Vector2f((target - start_position).xy()).unit_or_zero().dot( | |
Vector2f((target - next_target).xy()).unit_or_zero())); | |
const float safe_alpha = constrain(alpha, 0.f, M_PI_F - FLT_EPSILON); | |
float accel_tmp = config.max_acc_xy_radius_scale * config.max_acc_xy; | |
float max_speed_in_turn = computeMaxSpeedInWaypoint(safe_alpha, accel_tmp, config.xy_accept_rad); | |
speed_at_target = min(max_speed_in_turn, exit_speed, config.max_speed_xy); |
… the requirement for the same altitude in the 2D turning radius logic.
…withing the acceptance radius, and not exact position.
… as its done in the _getMaxXYSpeed
b696c45
to
8db0cf0
Compare
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.
Thanks for checking. Your latest commit is exactly what I was thinking about but I wanted to confirm with you 👍
Solved Problem
When conducting a survey, the drone tended to slow down and accelerate again when covering large altitude changes, with terrain following enabled.
Example Survey:
Without Fix:
This is best seen when looking at the velocity change in x and z direction in the plot above.
Solution
To solve this issue i added a turning radius for the vertical component, whereby I simplify the problem so that we consider the 2D case where the vertical component of the incoming vector is the norm of the xy component, and the z component.
I also removed the requirement for the XY turning radius that the altitude between the current and next waypoint have to be the same.
With Fix:
As we can see in the Plot above, the velocity changes close to the waypoints are gone.
Changelog Entry
For release notes:
Alternatives
We could also directly generalize it for the 3D case, but that would require alot more changes.
Test coverage