INAV 1.6: Fixed Wing PIFF Controller

Another new feature of upcoming INAV 1.6 (BTW, INAV 1.6 ALPHA-1 has just been released) is brand new PID controller for fixed wings. I repeat: this new controller is used only on fixed wings, multirotors are not affected.

So, what is new about this new PID controller? First of all, it is no longer a PID (Proportional, Integral, Derivative). It is a PIFF (Proportional, Integral, Feed Forward) controller. What is the difference?

Traditional PID controller computes error between setpoint and measurement and feeds it to 3 modules: P, I and D.

PID controller

Continue reading “INAV 1.6: Fixed Wing PIFF Controller” »

Read More

How to connect APM Power Meter to Cleanflight and INAV

This topic was eluding me for some time now. It’s time fix the problem and finally present a short tutorial how to connect 90A APM Power Meter for flight controller boards like Naza32, SP Racing F3 or any other running Cleanflight / Betaflight / INAV software and equipped with Current Meter ADC input.

I will not show where to connect APM Power Meter to flight controller, since this differs from board to board. Some boards have dedicated pins, on some boards PWM input pins are used for Current Meter ADC. You have to refer FC documentation and / or flight controller software documentation.

Continue reading “How to connect APM Power Meter to Cleanflight and INAV” »

Read More

INAV Configurator 1.6: Presets

Upcoming INAV 1.6, and INAV Configurator 1.6 will bring many important changes. I will try to cover most of them in a next few days, beginning with Presets.

Because INAV can run very wide spectrum of aircrafts, it suffers a penalty of very general default values. Different frame sizes, propellers, multirotors, airplanes, flying wings. It is impossible to have one set of default values that will make all those different UAVs fly good right after flashing. And it’s not only about PIDs. Also rates, filters and other settings differs between them. Good default tune for 5″ racer will not work on 1.2m flying wing or 1.6kg quadcopter on 12″ propellers.

To solve this problem, INAV Configurator 1.6 introduces new tab: Presets.

Continue reading “INAV Configurator 1.6: Presets” »

Read More

Using PCA9685 with INAV

One of the hardware limitations of flight controllers that usually multirotor users ignores is a number of PWM outputs. To fly a quadcopter you need “only” 4 PWM outputs. Since most FCs have 6 outputs and 90% of multirotors are quadcopters, there is no problem.

In case of airplanes, this is not that simple. 6 PWM outputs is an absolute minimum to fly a classic airplane using MultiWii and derivatives (Baseflight, Cleanflight, INAV): 2 outputs reserved for motors, 2 ailerons, elevator, rudded. Suddenly, 6 outputs barely meets the requirements. If you want flaps, gas engine, pan & tilt or anything else, you are missing some outputs.

For some time INAV tries to address this issue by supporting external PWM driver: PCA9685.

Continue reading “Using PCA9685 with INAV” »

Read More

SmartPort inverter for F4 flight controllers

While STM32F4 family processors installed in newest flight controllers are superior to STM32F3 (and F1 of course) in terms of raw speed, they are inferior to F3 family in terms of IO handling capabilities. For example, F4 family is not equipped with UART port inverters. And that creates a series of problems when it comes to connecting various serial RX receivers and telemetry systems.

The most popular FrSky (Futaba) S.Bus serial RX protocol and FrSky SmartPort telemetry require inverted UART signal. If there is no hardware inverter on hardware UART port, they will not work. While S.Bus requires only one data line, external inverter is not a big issue. Some time ago I’ve published The Simplest Harware Inverter. One MOSFET transistor, one resistor and that’s all.

In case of SmartPort, it’s slightly more complicated. Not only signal is inverted, SmartPort also combines TX and RX UART line into single wire. That means the following:

  1. More complicated inverter is required
  2. Software has to support this case and fallback to unidirectional UART mode


Continue reading “SmartPort inverter for F4 flight controllers” »

Read More

INAV: Launch mode video tutorial

One of the best new features of INAV 1.4 was Launch assistant mode (NAV LAUNCH). It greatly simplified the process of hand launching a fixed wing. All you had to do was to throw it into the air. INAV detected the throw, engaged motor(s) and stabilized flight and kept constant climb rate in the initial flight phase. INAV 1.5 will make it even better: it will also allow swing launch!

Since INAV 1.5 should be release in next 2 days, and there is very little info on INAV Launch mode, I’ve decided to create a short video showing how to do it.

Read More

INAV: how to setup asynchronous gyro

Together with version 1.4, INAV introduced asynchronous gyroscope processing. What is async gyro and why it is useful to have it, you can read here. In short worlds: data from gyroscope is read and filtered faster than PID controller updates motor and servo output.

When it is worth to enable asynchronous processing

In general, async gyro can be enabled when:

  • Flight controller does not ave enough processing power to run control loop faster than 2000us (500Hz mode). This is the case for all SMT32F1 boards like Naze32, Flip32 or CC3D
  • Flight controller is powerful enough to process PID control loop faster than ESC protocol (PWM, Oneshot125, Multishot) transfer commands to ESC and servos. This is usually true in case of all STM32F4 boards
  • INAV is setup on a “racer” machine that requires the best gyro signal possible

Async gyro should not be enabled when gyro and control loop frequency are the same. For example, 1kHz gyro and 1kHz control loop would give worse results than 1kHz synchronous processing. Continue reading “INAV: how to setup asynchronous gyro” »

Read More

Flip32 F4 and Airbot F4 Software Serial

When STM32F4 based flight controllers made its way to the world of MultiWii derivatives (Cleanflight and whole family), all I think all developers assumed that SoftwareSerial feature will not be needed on those boards. Why it should be? STM32F4 has enough hardware UARTs to satisfy everyones needs.

Unfortunately, live had it’s own point of view on that topic:

  1. Most F4 flight controllers have only 2 to 3 hardware UARTs available and usually one of them is shared with I2C (Revolution, Airbot F4)
  2. STM32F4 does not have internal hardware inverters. Hardware manufacturers usually put only one external inverter for S.Bus and that’s all

Because of that, Software Serial feature is coming back to F4 boards. Together with INAV 1.5, SoftSerial will be available on Airbot F4 / Flip32 F4 target on two small pads located near UART3 connector. RX line on pad CH5, TX line on CH6 line. Pads are quite small, but with basic soldering skills and decent soldering iron there should be no problems to solder thin cables to them.

Since F4 CPU is much more powerful than F1, limitation of 19200bps on Software Serial UARTs is no longer actual. I have tested 57600bps and 115200bps should be archivable.

Read More

INAV Advanced Accelerometer Calibration: why and how

One of the most often forgotten tasks required to bring the most of INAV, is good accelerometer calibration. Why? While flight controller software like Cleanfligth and Betaflight use accelerometer only to compute UAV’s body inclination (Angle and Horizon modes as well as artificial horizon), INAV uses it also for position estimation.

Cleanfligt has to only know where “down” is. For this, simple accelerometer calibration is fully enough: place UAV on a level surface and hit “Calibrate accelerometer” button. Few seconds and done.

INAV not only has to know where bottom is. It also has to know where all other directions are, and how fast UAV is accelerating in those directions to be able to estimate its position. For this, advanced, or 6 point accelerometer calibration is required.

How to perform Advanced Accelerometer Calibration [AAC]

During AAC, each side of flight controller has to be positioned “down” during calibration. Order is not important with one exception: during first step, top of flight controller has to positioned up. This is impotrant: we are calibrating accelerometer, not whole UAV. Even is FC is mounted upside-down, during first step, FC has to to positioned upwards.

  1. Prepare stable surface that will allow to keep FC stable in all required positions. Angles does not have to be super precise, even few degrees should be enough, but flight controller has to be motionless during calibration
  2. Plug-in USB and connect to INAV Configurator
  3. Position flight controller facing up and hit “Calibrate acccelerometer” button. Wait for success message
  4. Rotate FC 180 degrees so it is bottoms-up and hit “Calibrate acccelerometer” button. Wait for success message
  5. Rotate FC so its rear edge is facing down and hit “Calibrate acccelerometer” button. Wait for success message
  6. Rotate FC so its right edge is facing down and hit “Calibrate acccelerometer” button. Wait for success message
  7. Rotate FC so its front edge is facing down and hit “Calibrate acccelerometer” button. Wait for success message
  8. Rotate FC so its left edge is facing down and hit “Calibrate acccelerometer” button. Wait for success message
  9. Disconnet and power down
  10. Advanced accelerometer calibration is done. If is succeeded, acczero_x, acczero_y and acczero_z should different than 0, while accgain_x, accgain_y and accgain_z should be different than 4096

Advanced accelerometer calibration

Worth remembering: calibration values can be restored via CLI when flight controller firmware is updated. It is hardware, not software dependent. Calibration should be executed when new hardware is used.

Read More

What’s new in INAV 1.4

Although INAV 1.4 was not released yet, it’s going to happen very soon. When? Probably in the beginning of a next week. Release Candidate is already available and until now, there are no major bugs discovered.

So, what’s new in INAV 1.4? Quite a few…

  • IMPORTANT: by default, motor output is disabled after flashing. This is to prevent servos from being damaged with too fast PWM rate. User has to enable motor output using Configurator (version 1.4 or newer) or with CLI command feature PWM_OUTPUT_ENABLE
  • Asynchronous gyroscope processing. I’ve described some time ago why this is good idea to have something like this. With 1.4, asynchronous gyroscope is available, but not enabled by default yet. I will try to write a longer article how to set it up later (I hope at least I will find time for it). Until then, this entry in INAV docs is all that has been written on the topic
  • Airplane launch assistant. Launching an airplane with INAV is almost as easy as it can be! You can read documentation on this feature on INAV Wiki
  • Improved throttle PID attenuation (or rather PID scaling) for airplanes. Read documentation on the topic
  • Emergency landing for airplanes
  • Experimental Pitot tube support (logging only) compatible with Pixhawk PX4 Airspeed Sensor
  • Improved handling for GPS+MAG and GPS+BARO configurations. With INAV 1.4 it should be not required to disable MAG and BARO when GPS is used
  • Improved failsafe
  • New targets: Airbot F4 / Flip32 F4, Omnibus F4 and YuPiF4
  • Multiple bugs fixed

Additionally, new version of INAV Configurator has been already released. All users are advised to update! With Configurator 1.4.1 and firmware 1.4 following new features will be available:

  • Possibility to enable motor output
  • Gyroscope hardware filtering (gyro_lpf) and syncing PID loop with gyroscope (gyro_sync) setup
  • Advanced PID tuning now allows to set:
    • Gyroscope software LPF cutoff frequency
    • Accelerometer software LPF cutoff frequency
    • D-term cutoff frequency
    • Yaw P-term cutoff frequency
    • MAG_HOLD yaw rate limit
    • Axis acceleration limits
    • Yaw P limit and yaw jump prevention limit
    • I-term ignore rates

Read More