• **
  • 52
First fixed wing with Revo and 16.09+r782
« on: April 12, 2022, 01:02:03 am »
the previous flying season I spend with Revo & multirotor. I bought a second revo (that "mini" one) and mounted in my old Easy Star to get
some practice with fixed wing. Easy Start has no ailerons so I connected aileron channel (in output channel assignments) to the rudder.
I've done some tests flights and have some questions.
First is about the proper PID values. AFAIK fixed wing has no "autotune" function, right? So it have to be done manually. I've read all topics here related to PIDs and FW and to be honest I'm confused. The amount of information about PIDs is overwhelming and I don't know how to start. Is there any doc (or post on the forum I missed) which describes it simply step by step how to start with PIDs with FW like Easy Star (remember - no ailerons)? My tests flights was on defaults PIDs, I didn't noticed any (at least major) problems with flying with attitude mode (INS13) but after more tests I noticed the following:

1. In attitude mode the plane is flying smoothly, with no touching the elevator stick it maintains current altitude.
2. After switching to RTB the plane doesn't increase altitude as it should - why? RTB is configured to increase altitude +10 meters. It just makes a bank turn and flies leveled back. Above the base it makes a couple of turns/zigzags, often reduce the throttle almost to zero (why?) but always after a while it dramatically loose altitude (looks like a stall, after that loose of altitude makes increase of speed) and try make a big go around but it won't climb. Why in RTB mode it can't maintain the same/stable altitude? I added 30 degre pitch up in Attitude -> RotateVirtual but it won't help. Should I increase ThrustLimits max above 0,9 (BTW what 0,9 means - 90%?). During manual flight I have no problem to climb so this is not a problem with elevator or weak thurst/engine.
3. In PostionHold plane acts odd: it try a big go around and loose altitude, I have to switch to manual or attitude for recovery.
4. During RTB SystemHealth panel displays "PATH" in orange with the message: "Guidance: Warning timed out waiting for an attitude update". What does it mean?
« Last Edit: April 12, 2022, 01:10:12 am by Marico »

Re: First fixed wing with Revo and 16.09+r782
« Reply #1 on: April 12, 2022, 10:41:38 am »
If anyone has comments, additions, modifications to this, please post!!!  I would like it to become a detailed guide for fixed wing GPS flight mode setup.

It's been a long time, forgive me if any of this is wrong.

You are running a "recent" version of next.  That is what the +r782 means.  In case you need to know...

Most of my experience is with 16.09 (that is +r0) and with similar sized, aileron equipped airplanes.  I suspect that next acts like 16.09 in regard to what you are doing and what I am familiar with.

Be aware that Position Hold (and RTB at base=takeoff location) basically just flies straight toward the desired location and when it passes it, it turns around and flies toward it again.  I think this is also what it does when trying to gain altitude, like at the beginning of RTB when it is supposed to climb ReturnToBaseAltitudeOffset higher.  If Position Hold can't even hold altitude, much less climb, then it's not going to climb at the beginning of RTB?

The altitude code: I recall that I had to tune the altitude PID  I recall the throttle constantly going from 0% to 100% to 0%.  It's been a while, so I don't remember if this was also associated with sharp waypoint turns.  On one of my planes I recall just setting the thrust limits to reasonable values (gentle climb and gentle descent) and the oscillation was stopped or reduced.  I don't recommend that though.  I suggest that you read threads listed later about tuning the altitude PID.

The altitude code is a bit counter intuitive.  It acts like a big airplane's altitude code.  It is designed so that it's number 1 concern is to not stall out if the motors fail.  To climb it adds power (it doesn't directly pull up elevator).  If it is going "faster than desired" THEN it adds up elevator.  A nose heavy airplane helps so that when you add power it climbs (not just flying faster and remaining level).

The turning / banking code just banks.  It only adds up elevator when it sees the nose drop.  Properly tuning the PID will tend to minimize the time the nose is dropped, but not fix it perfectly.  The best thing for this is to configure it to make slow, wide turns where it has less reason to drop the nose and more time to correct when it does.  Don't adjust things to make it turn sharper until you have it flying well.  I hacked the code I am flying to immediately add some elevator at the time it banks.  It's just a hack based on bank angle and math.  A correct change would also use the airspeed (and/or a setting) to work correctly for any aircraft.

Be aware that the current code and default settings make fairly wide turns.  like multiple football fields wide...

If you haven't correctly set up your speeds (min and max in 2 places), etc. you will get errors.  As I recall, in waypoint flight, (by default) this makes it constantly go back to the first waypoint.

I presume that your main interest is waypoint, RTB, and other GPS modes; not in making the airplane easy to fly for a beginner.

One way to manually tune a PID is (my adaptation of the wikipedia page on PID ):
- this is best done on one channel at a time, e.g. just roll, while leaving the other channels set to default or some other working (not oscillating) value
- leave P default and set I and D to zero
- tune just P until it just starts to oscillate
- cut P in half and leave it there
- tune I to minor oscillation and back it off slightly from there (no oscillation or "ringing")
- leave D set to zero

I have an EasyStar and still have 2 new kits in the box.  :)  I have changed over to Bixler 1.x's because they have ailerons (and fly very well).  On the EasyStar I increased the size of the rudder control surface by gluing on a balsa extension.  This was originally called the credit card mod; I guess because someone glued a credit card on long ago.

Tuning a fixed wing the way I do it requires you to be able to fly, which is not good for beginners, but here it is:
- Set Attitude -> Settings -> Attitude Estimation Algorithm to GPS Navigation (INS13) (requires good GPS and mag setup and calibration)
- Set System ->Settings -> AirspeedSettings.AirspeedSensorType to GroundSpeedBasedWindEstimation
- Airplane balance should be a little nose heavy.  Nose heavy requires a little up trim to fly level and that up trim causes a climb at higher throttle settings.
- Start with Manual flight mode on all controls.  Trim the airplane for level flight.  Leave it in Manual mode for now.
- While flying, decide what feels good for cruise speed and set your elevator trim so that cruise speed does not climb or descend.  Don't use full throttle for cruise speed.  Half way between the slowest safe flight and full throttle is probably a good setting.  Trimmed (elevator) cruise speed should be low enough that just adding throttle makes it climb.
- Some settings are only accessible in the System page.  Setup is in Settings (and telemetry, like your current speed is in DataObjects).  The normal configuration stuff (in the Configuration pages) is just a pretty wrapper for the System page.  It's best to use the Configuration pages instead of the System page as they have better instructions and sometimes impose numeric limits.  On the System page, press the red up arrow a the top of the window to save the currently highlighted setting that you just changed.  Beware that some settings that seem like they should be in % are actually entered as numbers between 0.0 and 1.0, not between 0 and 100.
- Use telemetry (System -> DataObjects -> GPSPositionSensor.Groundspeed or AirspeedSensor.CalibratedAirspeed) on a calm day to get the actual numeric value of cruise speed (in meters per second) of straight and level flight (mild turns).  You will use that number.  It's a good idea to get your min speed (just safely above stall) and max speed (full throttle level) too.  Also get the throttle stick positions (numeric values) for min, cruise, and max speeds from System -> DataObjects -> ManualControlCommand
- While you have these numbers handy, set FWPFSettings.HorizontalVelMax/Min and .ThrustLimit.Min/Neutral/Max
- Adjust the control linkages so that you can put the transmitter trims back in the center.  You generally don't want to use trims except as a temporary thing.  Trimming in Manual mode messes stabilized modes and stabilized modes don't need trim (Rate should NEVER need trim and Atti should be trimmed with Attitude -> Settings -> RotateVirtual).
- For a 3 channel (rudder elevator throttle), from now on, pretend that the rudder is actually ailerons and that you don't even have a movable rudder.
- For 4+ channel setups (aileron elevator throttle and rudder) Always leave the rudder stabilization set to Manual.  Never put stabilization on the rudder function.  A stabilized rudder requires coordinated turns which the autopilot does not do.  (Your rudder function isn't actually connected to anything.)
- Be aware that switching from a Manual flight mode to an Attitude flight mode (and a lesser extent Rate mode?) has a windup issue.  For the first few seconds after switching, it will be (perhaps badly) out of trim.  A work around is to go to zero throttle (which zeros the windup), switch the flight mode, then throttle back up.  another work around as I recall and as documented in a post... is to use a Stabilized# mode set to be all Manual instead of using Manual mode directly.
- Don't bother with this now but later consider reducing the (I think) Rate PID ILimit (for roll and pitch) (System -> Settings -> StabilzationSettingsBank#) to reduce PID windup during Attitude mode hand launch.  Note that the windup looks like it occurs in the Rate section since the Attitude section has a zero I term by default.  Fly along in Manual mode for a while, then switch to Attitude mode.  It will go crazy for a few seconds.  This is what you are trying to fix.
- Tune rate PIDs (Configuration Stabilization InnerLoop) while flying in Rate mode (AETR=Rate Rate Manual Manual), at cruise speed.
- For a test: Increase the rate PIDs (P) till it almost oscillates at cruise speed.  Fly it and increase the throttle significantly above cruise speed.  It should definitely oscillate.  Put PIDs back to good values.
- Set StabilizationSettings.ScaleToAirspeed to your cruise speed number (the speed you tuned the PID at).  Now, increasing throttle should NOT oscillate any more.
- Tune attitude PIDs (OuterLoop) while flying in Attitude mode
- You haven't set up your min/max speeds yet, so GPS mode flight will set some error flags.  Look at FWPFSettings (HorizontalVelMax/Min) and SystemSettings (AirSpeedMax/Min) for places where you should consider setting reasonable speed values.
- I suggest a Waypoint mode test flight at this time.  Perhaps 4 waypoints in a LARGE square way above the trees.  If it keeps going back to the first waypoint, you are getting errors (over/under speed, etc.).  You can bypass the errors by setting Error Destination to -1 for all waypoints.  You can use 3 waypoints, but if you use only 2, you can't tell if it is getting an error and restarting at waypoint 1 or if it is completing successfully and restarting the waypoint set (it loops the waypoints over and over by default).
- Understand and possibly adjust FWPFSettings SafetyMargins and SafetyCutoffLimits so that GPS flight doesn't throw alarms (which will abort your waypoint flights and by default send you back to the first waypoint over and over).
- For a climbing / descending test, maybe do some waypoints that have noticeable altitude differences but not more than your airplane does just by increasing throttle; say a 15 degree climb/descent.
- Look here for some clues about getting the altitude/airspeed tuned.  You may need to adjust your Rotate Virtual (Attitude page).  I'm making a wild guess that your pitch angle should be zero at 100% throttle level flight because FWPFSettings has default PitchLimit.Neutral of +5 degrees.
- Once waypoints are working well, RTB should also work.
« Last Edit: May 05, 2022, 09:39:19 pm by TheOtherCliff »


  • **
  • 52
Re: First fixed wing with Revo and 16.09+r782
« Reply #2 on: May 03, 2022, 09:16:11 am »
If anyone has comments, additions, modifications to this, please post!!!  I would like it to become a detailed guide for fixed wing GPS flight mode setup.

Sorry for not commenting out in this thread but I decided to rebuild my very old  TX to add more channels  (replace the old original PCB and PPM generator with a custom one). My old TX has a limitation which limits selection of possible flight modes to only 3.
Now I have 6 modes which are much useful durning tests. I did a couple fixed wing flights with my first TX prototype but I not implemented the trimmers, yet. With mulitrotor they are not necessarily but  You mentioned above that trimmers will help in general with fixed wing so I decide to add them. I almost finished it and I'll be back soon with comments with FW.


  • ****
  • 300
Re: First fixed wing with Revo and 16.09+r782
« Reply #3 on: June 16, 2022, 04:04:57 am »
Note these comments are for next - not sure if they apply the same on 16.09, but I think so.
Not an expert on FW GPS modes by any means, but what worked for me was first to use the defaults with the following edits:
Under FixedWingPathFollowerSettings:
1) Narrow the thrust min maxes - I use min .1, neutral .35, max .7 -  the neutral point should be close to what you use for level flight, as that is the thrust value it will try to move up or down to adjust altitude via thrust.
2) Try adjusting the LandingPitch to a lower value - this tends to keep speed up more than if you keep the default value, which will then tend to help smooth out the surging. The LandingPitch is the AOA the RTB tries to maintain during RTB.

The RTB altitude target is the max of takeoff altitude and current altitude + the ReturnToBaseAltitudeOffset (defaults to 10m). This prevents you from flying into a hill if you activate RTB with aircraft BELOW takeoff altitude.
So most of the time it is flying back to a location well above you.