Hi, i am just a hobbyist and no programmer. But Itried some things. Maybe someone can make something nice of it.
First I dislike to first fly into hoover and then activate althold.
I like to choose on forhand the Mode : Acro, Attitude(Angle/Horizon), Altitude. Now the last one can only be activated while inflight in current MW.
So I changed the code that the baromode only activates by itself after preselecting Baromode and armed and having some altitude.
#if BARO
#if (!defined(SUPPRESS_BARO_ALTHOLD))
if (rcOptions[BOXBARO] ) {
if (!f.BARO_MODE && f.ARMED && (alt.EstAlt>50)) {
f.BARO_MODE = 1;
AltHold = alt.EstAlt;
#if defined(ALT_HOLD_THROTTLE_MIDPOINT)
initialThrottleHold = ALT_HOLD_THROTTLE_MIDPOINT;
#else
initialThrottleHold = rcCommand[THROTTLE];
#endif
errorAltitudeI = 0;
BaroPID=0;
}
So now you can preselect Baromode by aux switch before arming and you can arm normally.
Slowly increase throttle and slowly go into height above 50 cm.
Now at 50cm it is assumed you have aproxemitly hoover throttle and baromode is now truly enabled.
It would be nice if anyone could translate this aproach into a controlled software where 50cm is a target and using accz to detect hoover and then enable baromode.
Second discomfort is that the initial throttlehold can be anywhere in the throttlestick position. Resulting in a asymetric stick position for althold.
I like to have throttlestick center for hoovering.
Thus I changed software into
#elif defined ALTHOLDMODE2
if (abs(rcData[THROTTLE]-MIDRC)>ALT_HOLD_THROTTLE_NEUTRAL_ZONE) {
uint16_t altChange = abs(rcData[THROTTLE]-MIDRC);
AltHold = (rcData[THROTTLE] > MIDRC) ? (AltHold = alt.EstAlt + (altChange/2)) : (AltHold = alt.EstAlt - (altChange/2));
AltHold = constrain(AltHold, -32767, 32767);
isAltHoldChanged = 1;
} else if (isAltHoldChanged) {
AltHold = alt.EstAlt;
isAltHoldChanged = 0;
}
#endif
rcCommand[THROTTLE] = initialThrottleHold + BaroPID;
}
#endif
Now after BaroMode enables I move further my autocentering throttlestick to center and the copter is altholding at stick center.
By the way now stick movement is scale for altchange speed. The bigger stick movement the bigger output.
The original code was timebased contineously increasing Althold height.
And it overruns it size going from positve to negative when copter does not respond quick enough.
So I use the real altitude add the desired height increase given by stick and set althold target.
Now the added height from stick is constant offset in althold versus estalt.
In my example it limits to 500/2=250. So althold is constantly 250 above estalt. Or i.e 25 at 1/10 of stick position change.
So stick gives a constant offset from 25(neutal zone) to 250.
I wonder if this priciple is used in software like NAZA or so.
My NAZA equiped copter has transmitter with autocenter throttle and amezingly hoovers at center throttle and Altitude mode can be selected before arming.
With the above modification my Multi AIOP works in a simalar way.
Select BarMode on forehand.
Arm
Move throttle stick slowly to center and my quad hoovers at 50 cm.
Like i said i am just a hobbyist maybe someone can make this principle in a more professional manner.
Where it does not matter how fast you center the throttle stick the copter goes into hoover at designated height checks accz and goes into althold.
From there you can FPV / fly in althold mode.
