smark-

  • *
  • 16
Auto Take off negative vertical speed
« on: April 02, 2017, 10:23:13 am »
I'm having issues getting the auto take off to work. Basically, the first time I switch to auto take off the vertical speed is set to negative (as it's supposed to be), so if I move the throttle to mid range the props start spinning but the quad doesn't take off. However if I lower the throttle to 0, disarm and arm again, then the vertical speed is set to positive and the quad does take off if move the throttle to mid range. I guess this is not the intended behavior, what's wrong?


smark-

  • *
  • 16
Re: Auto Take off negative vertical speed
« Reply #1 on: April 03, 2017, 11:08:34 pm »
I have done some research on the wiki and I've found contradicting information. Here (https://librepilot.atlassian.net/wiki/display/LPDOC/GPS+Flight+modes) it seems that the right sequence is:

-Switch to AutoTakeOff flight mode
-Arm with the Throttle stick to minimum
-Increase the Throttle value to middle range

Whereas here in the AutoTakeOff section (https://librepilot.atlassian.net/wiki/display/LPDOC/GPS+Flight+modes) the sequence seems to be:

-Arm with the vehicle
-Switch to AutoTakeOff flight mode
-Increase Throttle

Which one is correct? The first does not work in my case, but I haven't tried the second yet.

f5soh

  • *****
  • 4572
    • LibrePilot
Re: Auto Take off negative vertical speed
« Reply #2 on: April 03, 2017, 11:57:00 pm »
Switch to AutoTakeOff after the vehicle is armed will be ignored.
The logic changed (and information not updated) to avoid switch to AutoTakeOff while already armed (and in some cases in air...)


smark-

  • *
  • 16
Re: Auto Take off negative vertical speed
« Reply #3 on: April 04, 2017, 08:57:11 am »
Thanks f5soh for answering. I was wondering, when is the autopilot supposed to switch from a negative vertical velocity to a positive one? Is it after arming or when the throttle is increased to mid range?

Re: Auto Take off negative vertical speed
« Reply #4 on: April 04, 2017, 07:43:49 pm »
I forget how this is coded, but you may have to go above mid throttle to get takeoff.

smark-

  • *
  • 16
Re: Auto Take off negative vertical speed
« Reply #5 on: April 04, 2017, 11:14:32 pm »
I have been digging into the issue some more and I'm afraid I have found a bug. I have debugged the VtolAutoTakeoff module after looking at the code and I could see the following:
When I go through the procedure and raise the throttle to mid range, the state machine goes all the way to "Take off", so I would rule out any errors there. However, if I look at the thrust, I can see that this is increased to max 0.2% and the VelocityDesired->Down is locked at 0.6 m/s. If I disarm and arm again then the thrust goes all the way to 0.8% and the VelocityDesired->Downswitches starts changing and it gets negative (in line with what I expect).
However, while on the ground and the quad disarmed, this happens only if I flip the switch from a stabilized mode to AutoTakeOff. Instead if I have my flight mode switch set to position hold and I switch to AutoTakeOff, this issue is no longer there and the quad takes off. Could you please verify if you experience the same behavior? Let me know if I can provide more details to sort this out

Re: Auto Take off negative vertical speed
« Reply #6 on: May 01, 2018, 09:06:22 pm »
Indeed, looks like a bug. I had the same issues on my quad. Created a PR with a possible fix: https://bitbucket.org/librepilot/librepilot/pull-requests/512/lp-598-autotakeoff-corrections
Not flight tested at this time.

Re: Auto Take off negative vertical speed
« Reply #7 on: May 01, 2018, 09:59:14 pm »
My thoughts based on what I remember from reading that part of the code a couple years ago or so.

Reading reply #5 I see from the fact that it works with PH, that it may be an issue with the vertical rate control (pidcontroldown.cpp).

This control is designed to be entered from a hover.  I don't have the code open right now, but initialization and thus the issue may only happen the first time you switch into a vertical rate controlled mode with each new battery.

It gets current thrust and assumes it is neutral thrust.  This is correct when entered from hover, but is wrong when entered from anything besides a hover, such as sitting on the ground with low or zero thrust.

<soapbox> This module tries to get the current throttle/thrust position to use it for neutral thrust, and that code is basically a hack that breaks the information hiding principle that you have between software layers. </soapbox>

There is already a problem with this when used with CruiseControl.  If you bank over a lot which runs the motor faster, and immediately switch to one of these vertical rate control modes, it will assume that the increased throttle position is "hover power".

It might be better to just (initially) use the neutral thrust as user configured in VTOLPF rather than try to determine it.  Yes it can vary with different battery state (full discharge or very low).

I have never attempted to use AutoTakeOff.
« Last Edit: May 01, 2018, 10:27:04 pm by TheOtherCliff »

Re: Auto Take off negative vertical speed
« Reply #8 on: May 02, 2018, 10:54:29 pm »
Hello TheOtherCliff,

I flight tested a quad with the change from LP-598. I performed about 6 automated takeoff and landings. All of them went flawlessly.
So it looks like the patch is an improvement. However more testing is certainly needed.