inav icon indicating copy to clipboard operation
inav copied to clipboard

The quadcopter is gaining altitude in POSHOLD mode

Open Pavel-DV opened this issue 5 years ago • 17 comments

Current Behavior

image blackbox_log.txt diff_all.txt diff_all pastebin

The quadcopter is gaining altitude in POSHOLD mode. I tried the ACRO+POSHOLD and ANGLE+POSHOLD modes, it still does not hold the height. When the POSHOLD mode is turned off, it flies very stably. Tried changing nav_use_midthr_for_althold, doesn't help. The screenshot shows that when the drone is gaining altitude, the throttle stick is fully lowered (rcData [3] == Zero - this is not a bug, I did it on purpose), while the flight controller sees that the drone is gaining altitude (navPos [2]), but still does not slow down the throttle (RC Command [throttle]), and continues to keep it at an average level.

Expected behavior

The drone does not gain altitude

Suggested solution(s)

Fix the bug

Additional context

dump pastebin


  • FC Board name and vendor: HAKRC F722 DM Mini
  • INAV version string: INAV/MATEKF722MINI 3.0.1 Jul 4 2021 / 14:32:29 (753c4479) GCC-9.3.1 20200408 (release)

Pavel-DV avatar Jul 13 '21 03:07 Pavel-DV

image

Every time you activate PosHold rcData[3] drops to min value. Check mixings in your radio. INAV seems to be following updated target altitude no problem

DzikuVx avatar Jul 13 '21 07:07 DzikuVx

@DzikuVx rcData [3] drops to min value because I'm pushing the throttle stick down to prevent the drone from flying into the sky. In any case, this does not explain why the drone is gaining altitude.

Pavel-DV avatar Jul 13 '21 12:07 Pavel-DV

Hmm, you pulled THR zero even before quad started to climb. You activated PosHold and then immediately pulled THR low. Why? What is the rationale of that? When activating PosHold you should keep THR alone or move it to mid position if you have set nav_use_midthr_for_althold = ON. And you have. Something does not add up over here

DzikuVx avatar Jul 14 '21 07:07 DzikuVx

Why such a big difference between navPos [2] and the Baro reading, > 10m at times with navPos [2] negative when the Baro is above 0 ? Acc[z] looks a bit noisy compared to the other axis ... enough to affect things ?

breadoven avatar Jul 14 '21 08:07 breadoven

@DzikuVx I pulled THR zero to prevent the quadrocopter from flying into the sky, I did it automatically because I knew in advance that it would start to climb. I tested it many times, and already remember how it behaves when POSHOLD is turned on. Therefore, I immediately pressed the throttle down. There is no problem with that. The problem is quite different. As I wrote above, the problem is that the drone climbs on its own, without a command. When I haven't pulled THR zero, the drone is still gaining altitude. Sometimes it is possible to make it start to decline, but this is rare. Most often it only flies up.

@breadoven I don't know why there is such a big difference. Perhaps this is the bug, but I'm not sure.

@DzikuVx Why did you close this issue? Could you please open it back, since it hasn't been solved yet? If you need additional tests, please let me know which ones, I can test.

Pavel-DV avatar Jul 14 '21 15:07 Pavel-DV

@Pavel-DV can you share a diff? Much easier if I don't have to scroll to the full settings list.

avsaase avatar Jul 15 '21 16:07 avsaase

@avsaase yes, it is in my first post, under the screenshot.

PS: link to diff

Pavel-DV avatar Jul 15 '21 16:07 Pavel-DV

Why did you turn off automatic declination? Have you set it to the correct value? I'm not saying this is causing your problem but it could cause problems in general.

avsaase avatar Jul 15 '21 16:07 avsaase

And what is CAMTRIG in your screenshot?

avsaase avatar Jul 15 '21 16:07 avsaase

Why did you turn off automatic declination? Have you set it to the correct value? I'm not saying this is causing your problem but it could cause problems in general.

Since I live in Boston, USA, I set the declination corresponding to my geolocation according to the tables in order to exclude an error during automatic calculation.

And what is CAMTRIG in your screenshot?

I assume that in this way the Betaflight Blackbox Explorer displays the switching of the POSHOLD mode.

PS: @avsaase, I just checked it out, it really is.

Pavel-DV avatar Jul 15 '21 16:07 Pavel-DV

I have to admit it don't see what the problem is. The quad seems to track the target altitude very accurately, it's just that the target altitude is increasing when you don't want it to.

avsaase avatar Jul 15 '21 17:07 avsaase

it's just that the target altitude is increasing when you don't want it to.

This is precisely the problem. Why does the target altitude increasing on its own without a command? @DzikuVx, can you help?

Pavel-DV avatar Jul 15 '21 17:07 Pavel-DV

Actually looking at the log again it's obvious that navVel[2] is always negative regardless of whether it's climbing or descending, just becomes less negative when climbing. Also navTgtVel[2] is always negative which would be correct, demanding descent. But instead it climbs because navVel[2] is indicating negative vertical velocity when in fact it's ascending. So this is something to do with actual vertical velocity being miscalculated making it think it's descending when in fact it isn't.

It is commanding a change to target altitude, NavFlags in the log shows "ADJUSTING_ALTITUDE" during Poshold because the throttle stick is lower than the position when Poshold was first selected. Just isn't adjusting correctly because of the above.

Set debug_mode to ALTITUDE and run another test, post the log here.

breadoven avatar Jul 15 '21 22:07 breadoven

I noticed you already have debug_mode set to ALTITUDE in the Diff. However, looking at the log again the values in log 3/5 are all 0 apart from 5 which is stuck on -37. Not sure why that is, the debugs should be available in 3.0.1 (@avsaase ?). Still think this is related to g(Z) levels. They're 10x higher in amplitude compared to my 5" quad with a guesstimated average consistently less than 1g (around 0.9g). Something's not right.

breadoven avatar Jul 17 '21 08:07 breadoven

@breadoven How did you determine the guesstimated average? Do you think the problem is in the accelerometer filters?

Pavel-DV avatar Jul 17 '21 13:07 Pavel-DV

Guesstimated just by looking at the trace on Blackbox Explorer and judging where the average appeared to be then measuring that value. Always seems to be less than 1g. You'd have to ask others what the issue is, not really my thing, I just compared it with my logs and noticed g(z) looks noisy which may explain why the Z position estimates are nonsense.

breadoven avatar Jul 17 '21 16:07 breadoven

@breadoven , @DzikuVx

image

It is possible that the problem is in the accelerometers. The stronger the vibrations, the lower the reading. Is this a software bug or a hardware bug?

The log file attached. Debug mode set ACC. blackbox_log.txt

Pavel-DV avatar Jul 18 '21 04:07 Pavel-DV