Fixed Wing PID windup issue going into Attitude, RTB, etc.
« on: June 15, 2017, 07:12:28 pm »
There is an issue in 1609 fixed wing stabilization.  When flying Manual the stabilization PIDs wind up so that when you switch to a stabilized mode it can go very bad for a couple seconds while the PIDs unwind.  This is mainly a problem for switching into Attitude mode.

This is especially bad for flying Manual and expecting RTB to work without crashing, since RTB uses Attitude stabilization.

Several work arounds:
- (experts) if you are just testing near by, you can man handle it by manually correcting for a couple seconds when you switch from Manual to Attitude.  Just expect a problem and be ready for it.  I have to hold full up and left.  Not for beginners...
- (beginners) if you are just testing near by, you can zero the throttle, then switch to Attitude mode then run the throttle back up.  Zero throttle instantly unwinds the PIDs.
- if you might be flying far away, fly in Attitude mode so the PIDs won't wind up, so that when RTB engages it doesn't go crazy.  Do the switch from Manual to Attitude close by to get it handled before flying farther out.

This would be a simple fix to have Manual mode constantly zero the windup.

I've been living with this for a while, but I see that some people (@jdl?) may be having this issue, and I thought I would post about it.

jdl

  • **
  • 93
Re: Fixed Wing PID windup issue going into Attitude, RTB, etc.
« Reply #1 on: August 07, 2018, 12:57:52 pm »
I've inspected the flight code and found a simple workaround for this issue, I think.

Do not set Flight Mode to Manual in Flight Mode Switch Positions.

Instead, set Flight Mode to Stabilized 6, e.g., and then setup the Roll, Pitch, Yaw & Thrust = Manual for it in the respective row in Stabilization Modes Configuration.

This will force all axes to reinitialize upon ANY flight mode change, incl. from "Manual", as it is now treated as just another Stabilization Mode, and will zero the integrals:

stabSettings.innerPids[t].iAccumulator = 0;
stabSettings.outerPids[t].iAccumulator = 0;


effectively canceling the potential windup.

I'd like the "Zero the integral when throttle is low" to be disabled to help when gliding the plane without throttle. This can, however, cause trouble on take-off. But with the previously described setup, I just need to switch from Manual to Attitude *JUST* before launch to zero the integrals ;)

The only drawback I see with this setup is that manual controls do not work until the EKF is initialized. Not a big deal...

Re: Fixed Wing PID windup issue going into Attitude, RTB, etc.
« Reply #2 on: August 07, 2018, 03:48:08 pm »
My standard work around is to use Rate mode where I would have otherwise used Manual mode.  Hand launch in Rate mode doesn't need up elevator like hand launch in Manual mode.

For newbies doing FPV, think about what mode you want to be flying when your video fades out for 10 seconds...  Attitude mode or the GPS modes that automatically level are the safe ones.

jdl

  • **
  • 93
Re: Fixed Wing PID windup issue going into Attitude, RTB, etc.
« Reply #3 on: August 07, 2018, 04:21:07 pm »
I generally avoid using Manual. I also find Rate best for flying but prefer launching in Attitide with 20-30% up elevator, depends on plane.

Still, I like to keep Manual as an option in Flight Modes .

GPS modes like RTB, PH and PP are mandatory for a FPV plane, I think, especially RTB ;)