That's it
@crazyal:
You have quite high value of acc weight for alt (baro_cf_alt)….
I have notticed that my copter holds the altitude better when i set:
baro_cf_alt = 0.945 (if higher, copter is descending)
baro_noise_lpf = 0.01 (if higher, copter is not holding altitude at all, but overshoots it permanently - it's because of my baro "shielding" perhaps…foam inside the box)
accz_deadband = 5 (if higher, copter is descending and holds altitude worse . Looks like I don't have too much vibrations and that value can be so low)
p_alt = 85 (if lower, descending)
i_alt = 25d_alt = 35 (60 is too much, as copter is nervous)
So….I assume that descending is directly corelated with battery voltage drop.
E.g. MK has something like this (in order to prevent battery voltage drop influence on motors RPM):
Code: Select all
if(UBat > BattLowVoltageWarning) GasMischanteil = ((unsigned int)GasMischanteil * BattLowVoltageWarning) / UBat;
Which means, that if voltage is higher than alarm voltage, then we are lowering throttle value in order to sustain RPM's.
(so lowering throttle value, instead of rising it - for battery and copter safety of course)
The higher battery voltage, the stronger correction (lowered throttle) is made.
Yes, I know that i_alt should help here, but the boarder is very thin. Too high value, and copter will be overshooting. Too low, and it won't help.
Besides…. with such a additional motors RPM "extender", we will have same i_alt (and p_alt!) values, for different batteries (or maybe even copters, as weight counts).
EDIT:
And of course, it will help copter to hover while althold is turned off.
No additional parameters needed, simple and it works (I've tested it in another copter).
What do you think?
EDIT: btw. in mw.c, just after:
Code: Select all
if (cfg.throttle_angle_correction && (f.ANGLE_MODE || f.HORIZON_MODE)) {
rcCommand[THROTTLE] += throttleAngleCorrection;
}
…we can add something like this (not tested!):
Code: Select all
#ifdef BATTERY_CORRECTION
if (feature(FEATURE_VBAT)){
if (vbat>batteryWarningVoltage)
rcCommand[THROTTLE] = (rcCommand[THROTTLE]*batteryWarningVoltage)/vbat;
rcCommand[THROTTLE] = constrain(rcCommand[THROTTLE], mcfg.minthrottle + 150, mcfg.maxthrottle);
}
#endif
And that's it
