inav icon indicating copy to clipboard operation
inav copied to clipboard

Slow altitude gain in ALTHOLD mode.

Open NeilGaede opened this issue 8 years ago • 12 comments

In angle mode, steady hover, turn on ALTHOLD, neutral (spring to center) throttle. Copter jumps slightly, then steadily gains altitude. Blackbox shows a constant altitude gain on BARO.

Flip off ALTHOLD, copter descends, flip on ALTHOLD, copter jumps slightly, then steadies and gains altitude steadily.

What am I doing wrong. Do the velocity and/or position PID values have anything to do with it?

Thanks for the help. Here is the dump and blackbox log.

Neil

CLIDUMP1.txt RISING.TXT

NeilGaede avatar Jun 02 '18 00:06 NeilGaede

I think I may have a possible answer. I have a spring to center throttle. My throttle_mid is set to 1500, and my deadband for altitude change is 50. Because I don't hover at 1500 I have my expo set about 25. When my throttle is at center blackbox show it at 1440 or so, which is above (below) deadband. So when I initiate althold, even though my throttle is in the middle, it see the expoed valve of 1440 instead of the actual middle position and somehow this messes up the velocity controller, though I'm not sure why it wouldn't descend instead of climb, but blackbox clearly shows a target velocity of 53 and target position of 360, though in theory I would think velocity target should be zero.

Somehow it would be nice to be able to have nav_use_midthr_for_althold use middle stick position instead of middle rccommand_throttle.

NeilGaede avatar Jun 02 '18 05:06 NeilGaede

After wading through the code I still don't have an answer to this issue. Is it possible it is just a position/velocity PID setting I need to make?

NeilGaede avatar Jun 04 '18 09:06 NeilGaede

@NeilGaede I don't spring to center for throttle, and my hover throttle position for my 220mm quad is 1405. I use the following two settings which works perfectly:

set nav_use_midthr_for_althold = OFF
set nav_mc_hover_thr = 1405

Of course, this won't work for you. But I believe you need to verify these two settings. I would think you need to set nav_use_midthr_for_althold to ON and nav_mc_hover_thr to whatever throttle value actually makes your quad hover. Maybe that's 1440, but not sure if you have your throttle stick calibrated so center is hover, I'm assuming so.

So I would assume these should be your settings:

set nav_use_midthr_for_althold = ON
set nav_mc_hover_thr = 1440

teckel12 avatar Jun 04 '18 14:06 teckel12

I think I may have a clue. I have mid_thr set to zero so I can get my expo right; if althold is using that value as middle throttle there will be a problem. I need a way to use mid_rc as middle throttle instead of my expo middle value. Not sure why you would use middle of expo as throttle center...

I will try changing it in code and try it. Thanks for the tips though.

I do have nav_use_midthr_for_althold = on and nav_mc_hover_thr = 1500.

I have spring to center throttle and I set my mid_thr =0 and expo so that the copter hovers at stick center.

I think it needs to be changed to use mid_rc instead of mid_thr (expo).

NeilGaede avatar Jun 07 '18 09:06 NeilGaede

@NeilGaede See #3313 (Deprecate mid_rc setting)

teckel12 avatar Jun 07 '18 12:06 teckel12

That is not good news. I just changed the code to use mid_rc instead of expo mid and it works perfectly.

NeilGaede avatar Jun 08 '18 08:06 NeilGaede

I guess I could use nav_md_hover_thr or just hard code it to 1500. Either way, it would be nice to have the option without having to alter code and build myself.

NeilGaede avatar Jun 09 '18 08:06 NeilGaede

Actual problem is that throttle expo mid (percent) operates on range [minthrottle;maxthrottle] and is therefore not very intuitive because it's not directly related to stick travel. A proper solution would be to make throttle expo curve to operate on stick travel.

digitalentity avatar Jun 09 '18 09:06 digitalentity

Also note, that your actual throttle middle is not center stick. Stick travel is mapped by RC code from range [mincheck;2000] to [minthrottle;maxthrottle]. Since mincheck is 1100 by default, an exact middle of throttle range is at 1550 of raw stick value.

digitalentity avatar Jun 09 '18 09:06 digitalentity

There is an effort of heavy refactoring of rcCommand handling code which will eliminate the root cause of the issue, but I didn't have the time to finish it by 2.0. Until it's finished - I'm afraid you'll have to maintain your own patched firmware (or figure out the throttle expo mid setting that will correspond to middle stick with your setup)

digitalentity avatar Jun 09 '18 09:06 digitalentity

This issue / pull request has been automatically marked as stale because it has not had any activity in 60 days. The resources of the INAV team are limited, and so we are asking for your help. This issue / pull request will be closed if no further activity occurs within two weeks.

stale[bot] avatar Aug 08 '18 09:08 stale[bot]

Automatically closing as inactive.

stale[bot] avatar Aug 22 '18 10:08 stale[bot]