Monday 1 July 2019

Collection of Fixed Wing iNAV tips

This page will record any clever Fixed Wing INAV tips I pick up over time.

Most of these tips come from
Facebook INAV Fixed Wing Group
Pawel Spychalski's YouTube Channel
INAV WIKI
and some very helpful YouTube subscribers.

1. Transmitter Trims (Pawel)
Transmitter trims should not be used, don't touch them. All trimming should be done by adjusting pushrod lengths, or using INAV Autotrim, or adjusting servo midpoints in INAV.
You can actually disable the transmitter trims.
In the Taranis Flight Modes screen change all the trim values on the default flight mode FM0 from (: 0) to (- -)
The trims will disappear from the transmitter screen and no longer be active  The trim switches now can be setup as normal switches for other uses. Which is quite useful because it's easy to run out of normal mode switches on transmitters like the QX7.

2. Only need one model setup (Stewie - UAVFutures)
Programming setup in your transmitter is identical for all iNav models. Wings, planes and even quads need the same 4 channels and mode switches. So you only actually need one iNav Model in your transmitter. Using the D16 protocol (not ACCESS) you can bind as many receivers as you need to this one OpenTX model if you set the receiver number to 00.
You can have all the extra functions like flaps and pan/tilt programmed in and just not use them on models that don't require them.

3. Forget about Angle and Horizon Modes (Pawel)
Well, maybe don't forget about them, but I never use Angle as an actual flight mode. With Angle Mode you have to hold the stick at the angle you want the plane to maintain. The board has to be perfectly aligned to maintain altitude in these modes. It's a self-level mode, which might appeal to beginners, but to me it feels like you have to fight the board to make the plane fly where you want. Horizon Mode is Angle Mode for the initial stick movement, then ACRO Mode for the rest of the stick movement. The change over point is something like 75% of the stick movement, and can be changed.

Angle Mode is necessary to initially setup the board alignment (mainly pitch degrees) and is automatically activated with the GPS modes. That's why when you select one of the GPS modes, before satellites are acquired, Angle Mode will be activated and shown in the OSD.
Angle is also useful on the bench to check that the control surfaces move in the correct direction for stabilisation.

I usually launch in Acro or Manual mode, fly around the field in Acro, go for an FPV cruise in Alt Hold, then use RTH to come back from a long way out.

I do still have Angle available as a mode for board alignment.

4. PIFF (PID) Tuning (Wiki, Pawel)
Increase FF until control surface movement in Acro (or Angle) is 90% of Manual Mode
This will give you all the control surface movement you need while saving some for stabilisation.
One of the biggest problems in a new iNav build is that you start with much less pitch and roll control  in Acro and Angle compared to Manual. I have been caught a few times with insufficient pitch control to get over trees while testing stabilised modes. 

My FF ends up at 50 to 100 depending on the model. P and I terms are less important for fixed wing. Mine seem to end up around P=7 and I=10 but I'll do some further PIFF testing to confirm.

Autotune attempts to do these adjustments for you, but doesn't always get it right. I prefer to set them in the field using the  iNAV OSD Menu. Access the OSD Menu by using the Enter OSD Menu Stick Command. You can make all the adjustments using your transmitter sticks.

UPDATE 10 Sept 2019: Pawel's latest tuning tips from this video.

1. Work out your roll pitch and yaw rates (degrees per second) by doing full stick rolls, loops and rudder turns, in manual mode. 
Example - If a full stick loop takes 2 seconds then the pitch rate is 180dps
Enter these rates into the Rates section of the PID Tuning page
Average rates are Roll - 250, Pitch - 150, Yaw - 90 (Ignore yaw when you don't have rudder)

2. PIFF Values
Change P to ZERO (Actually I think about 5 feels better)
Change I to 7 (around 6 to 8 and never more than 10)
Use AutoTune to set FF value (or increase FF to get 90% throws in ACRO)
Change Gyro LPF Cutoff to 20

3. CLI
Try set fw_iterm_limit_stick_position = 0.25 (Stick position where Angle changes to Acro. Default is 0.50) for a more natural and in control feeling, with stabilisation when sticks are near the centre.

5. Check List before your first flight

On the bench and hooked up to your computer

1. iNav Configurator Receiver screen - Ail, Ele, Thr and Rud values must increase when you move the transmitter sticks up and to the right. This means the stabilisation will work in the correct direction. If a channel value decreases instead of increasing, reverse the weight in your transmitter mixing.

2. Check that values range from 1000 to 2000 when you give full movement to the sticks. Adjust end points in your transmitter mixing if the range is out. I have to use -97 to +97 on my Taranis channel end points.

3. Check control surface movement using the transmitter sticks. If a servo is moving in the wrong direction go to the Servo screen in iNav Configurator and click Reverse for that servo.

4. Check that your Modes switches are working as expected and have one combination of switches that has no modes selected. For me it's all switches up. With nothing selected the plane will be in RATE / ACRO Mode

Outside or at the flying field

5. Check that the GPS is working and acquires more than 6 satellites. You will not be able to arm the board otherwise. Motor will not be active until the board is armed.

If all the above checks out you will be good to go. Time to be brave and throw that plane in the air.

Start in Manual Mode and fly up to a safe height, switch Manual off when you're flying calmly to see how ACRO mode performs. Be prepared to switch back to Manual if something unexpected happens.

Check other modes as your confidence builds.

6. Save your FPV OSD layout
Rather than having to setup the OSD again for every new iNav build you can copy the relevant CLI entries from a previous build, and save them as a text file. Then you can paste them into the CLI for the new build.

Type "Diff" into the CLI then hit Return
Copy all the lines starting with "# osd_layout" and save them in another text file.

osd_layout 0 lines refer to the Default layout
osd_layout 1 lines refer to Alternative layout 1
osd_layout 2 lines refer to Alternative layout 2
osd_layout 3 lines refer to Alternative layout 3

I have a text file with Default and Alt layout 1 saved and available to paste into each new setup.

Here are my OSD layouts at the moment. 
Default layout has Distance to Home and Trip distance included, but not in Alternative Layout 1 




7. Trim the Board Alignment in the field using Stick Functions
To get the plane flying level in Angle Mode you usually need to adjust the Pitch Degrees in the iNav configurator Configuration Screen. Rather than connecting to a computer you can do this using your transmitter sticks.

Have a look at the Mode 2 Stick Functions picture above.
If your plane descends when you switch to Angle Mode you need to add Pitch Degrees to the board alignment. Trim Acc Backwards is the stick function you will need.

With the board disarmed, push the throttle to full up and elevator to full down.
Watch the fast flashing LED on the board (Matek F405 Wing) and notice that it will start flashing slowly. One flash equals about 1/3rd of a degree of Pitch Degrees, so 10 flashes will trim by 3 degrees.

Fly again and adjust as required.
If the plane pitches up in Angle Mode try a few degrees of Trim Acc Forwards. Same for left and right.

My planes seem to need about +3.0 to 4.0 Pitch Degrees.

8. Default Mode is ACRO or RATE
If you have no modes selected you are actually in ACRO Mode (also called RATE), not MANUAL.
I use ACRO Mode 90% of the time for general flying around. ACRO is stabilised but not self levelling.

From the iNav fixed wing WIKI:

Default flight mode (No mode selected) 
The default flight mode does not self level the aircraft around the roll and the pitch axes. That is, the aircraft does not level on its own if you center the pitch and roll sticks on the radio. Rather, they work just like the yaw axis: the rate of rotation of each axis is controlled directly by the related stick on the radio, and by leaving them centered the flight controller will just try to keep the aircraft in whatever orientation it's in. This default mode is called "Rate" mode, also sometime called "Acro" (from "acrobatic") and is active whenever no auto-leveled mode is enabled. 

9. AIR MODE 

Air Mode is not a flight mode. It is a modifier function that ensures the PID loop (or stabilisation) is still active when the throttle is low or zero. 
Before INAV 2.6 the annoying thing about AIR mode was that it showed in the FPV OSD as the current flight mode. That has now been fixed so AIR MODE can be left ON all the time, but you will see the actual flight mode in the OSD.

10. ACRO actually does mean ACROBATIC

On planes with rudder, ACRO mode is designed for Assisted ACROBATIC flying, and not normal cruising around like we all expect. This means that you must use rudder for turns. If you try to turn without rudder input (bank and yank) iNav assumes you are trying to roll into a knife edge and keep flying straight. The rudder will act to resist the natural yaw of the turn.

To overcome this unexpected behaviour, Yaw P and I gains can set at zero. Then you can turn using bank and yank or do coordinated turns with rudder input. There will be no yaw stabilisation, but I would prefer that to unexpected knife edges. Or you can choose RC Yaw instead of Stabilised Yaw in the Mixer.

V-Tail planes have less effective rudders so this behaviour may not be so obvious. Flying wings dont have rudder so it is not an issue.

11. Turn Assist and Overactive Rudder can cause tip stalls in RTH and POS Hold

With Turn Assist activated iNav uses rudder, elevator and ailerons to turn in all the Nav modes. If you have noticed aggressive yawing, overshooting and maybe even tip stalls when you select RTH it's probably due to excessive rudder throws.

Reduce Rudder throws mechanically or reduce Yaw FF for safer and smoother GPS mode turns.

Or you can reduce the amount of rudder in the mix by reducing Turn Assist Gain via the CLI.
Turn Assist is ON by default even though it may not be activated in the Modes Page.
Gain is set at 1.0 with allowed range 0.0 to 2.0

Try gain values less than 1.0 to reduce the effect or turn it off with gain of 0.0.

Set fw_turn_assist_yaw_gain = 0.0

12. Prevent disarming in mid air (Marc Hoffmann)

I have often disarmed in the air by accidentally knocking the arming switch, requiring a glide back to earth with no power. I believe it is possible to re-arm in the air, as long as throttle is at zero and no modes are selected.

But there is a setting that will prevent disarming unless throttle stick is at zero.

set disarm_kill_switch=OFF

13. Horizon Drift (Marc Hoffmann)

Horizon drift is an error in roll axis levelling that occurs after prolonged banked turns.
It's only evident in GPS or autopilot modes, and shows as a tilted artificial horizon in the OSD.

To reduce Horizon Drift add the following line to the CLI

set imu_acc_ignore_rate=7