-
Notifications
You must be signed in to change notification settings - Fork 18.7k
There may be a bug in void AP_MotorsMatrix::output_armed_stabilizing() #24235
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
Comments
Thanks for the investigation and report. Maybe you could provide some more evidence showing the current values are incorrect? Perhaps pass in some test value and provide the resulting output. Another alternative may be to test in SITL to see if you can recreate situations where the existing formula comes up with the incorrect output? Sorry to be annoying but it takes quite a lot of effort to investigate these reports and most of the time we determine that there is no actual error. It's more often something has been overlooked in the report. |
OK, I have updated it. |
Hi @luweiagi, As always, I appreciate you looking so closely at the code!! I don't believe this is a bug. The purpose of rpy_scale is to limit the roll, pitch and yaw if we want to prioritise low throttle. When we have high throttle we always prioritise roll, pitch and yaw over throttle. This means we only adjust the rpy_scale if the lower limit can't fit. If the upper limit can't fit then we reduce the throttle to give it room. The second limit problem you pointed out isn't really a bug but more of an approximation. It is possible that one of the three axis may be able to be increased without increasing the saturation but the calculations required to remove this approximation would be expansive and complicated. Have I missed something? |
@lthall Thanks for your patient reply!
I have a case I can not figure out: But, I think another method which follow what you said:
rpy_high - rpy_low = 1.8 - (-0.2) = 2.0 This method truely follow what you said:
Because we want to prioritise low throttle , so throttle_thrust = 0.2 is keeped, not reduce. So copter will not descend faster than desired(throttle_thrust) which I think is not safe. But reduce the throttle for rpy control is also not safe, so I am confused which method we should choose. How do we balance the hazards of descent exceeding expectations and attitude loss control? |
@lthall ball is in your court on this one, I think. |
Sorry @luweiagi, I missed your follow up. I think the problem appears here because you are using values of rpy_low and rpy_high that we can't obtain with a real motor mixer. The key limitation is that the inputs roll, pitch, yaw and thrust are orthogonal. If we have roll, pitch and yaw all one we would get quad X outputs of 3, -1, -1, -1.
rpy_scale = 1/4 = 0.25
if throttle_avg_max = 0.3, throttle_avg_max + rpy_low < 0
We scale that down to get 0.75, -0.25, -0.25, -0.25
throttle_thrust_best_rpy = - rpy_low = 0.25
throttle_thrust = 0.2
thr_adj = -0.05 < 0.0
So I think the reason you are getting this funny result is you are using values that we can't get with a properly orthogonal mixer. |
Uh oh!
There was an error while loading. Please reload this page.
@lthall
bug is in
void AP_MotorsMatrix::output_armed_stabilizing()
athttps://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_Motors/AP_MotorsMatrix.cpp#L366
code should be modified from A to B:

A:
B:

why add
let's prove it:
we write python code to find:
The python code produces many results, we only choose one example to analyze:

rpy_low = -0.2, avg_max = 0.5, rpy_high = 0.9
// =====================
// === second bug: =======
// =====================
here has bug in red box:

The text was updated successfully, but these errors were encountered: