What is Betaflight 3.5 Feedforward and how to use it

Betaflight 3.5 is just around a corner and it brings new cool things. There is no more Dterm setpoint weight and Dterm setpoint transition (relaxation ratio). They all were replaced by easier to understand Derivative and Feedforward (Feed Forward when you refer to the control theory tho).

Betaflight Derivative and Feedforward parameters are the new way of controlling "damping force" of the Dterm and responsiveness of a drone. The more Derivative gain you set, the more "damped", "delicate" and "swooshy" drone will be. The more Feedforward gain you apply, the more responsible to the sticks it will be. It's almost the same as with Dterm setpoint weight, but in my opinion, made simpler and can be set separately for each axis.

Betaflight 3.2 Dynamic Filtering Explained

With upcoming Betaflight 3.2, we will be given a new, outstanding, new feature: dynamic filtering. An belive me, it was worth waiting for Betaflight 3.2 only to get it. I do not care much about other changes that happened with version 3.2 but dynamic filtering it the thing! In this post I will explain, in simple words, what is dynamic filtering and how to enable it.

The problem of noise

Gyro has a nasty tendency to pick up a lot of noise. Vibrations. After all, there are a lot of things that can vibrate (motors, propellers) and resonate (frame). Without a good way to filter all that noise out, our racers would not fly as good as they fly now. And you would be replacing motors and ESCs even more often. I you want to know more about gyro noise sources and filtering, please watch my Gyroscope and filtering series on YouTube.

Continue reading Betaflight 3.2 Dynamic Filtering Explained

Understanding Dterm: how Dterm really works

I will be very honest: until very recently I did not really understood how PID controller’s Dterm really works. Yes, something with dampening, something with “looking into future”, bla bla bla. But the reason for not understanding was because I was overthinking it. There is no “magic” only simple mathematics and few basic concepts which I will now explain.

Setpoint

Setpoint is the value which we request from our system. In case of multirotors, PID setpoint will be a rotation speed around axis given in degrees per second [dps]. Setpoint 0 means we do not want to rotate (keep current attitude) and setpoint 200 means we want to rotate at 200dps

Measurement

Measurement the value that represents actual state of the system measured by some kind of sensor. In our case, it will be the gyroscope and rotation-around-axis speed measured in degrees per second

Error

Error the difference between Setpoint and Measurement computed as Error = SetpointMeasurement. In our case, when Error is above 0, that means drone is rotating too slow and should speed up. If Error is below 0, drone is rotating too fast and should slow down

Understanding Dterm - setpoint measurement and error Continue reading Understanding Dterm: how Dterm really works

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

JavaScript PID controller

I suppose this is the first time programing topic came up on this blog. Probably not the last time, since this is what I do most of the time.

While working on serial port usage balancing for INAV Configurator I’ve quite accidentally created a PID controller in JavaScript. Maybe it’s not the most advanced PID controller ever, but has all the things required:

  • computes P-term
  • computes I-term
  • computes D-term
  • has output limiting
  • has I-term accumulator limiting

Continue reading JavaScript PID controller

PID looptime: why it is not only about frequency

Last 18 months was an extremely good period of time for all mini-quad enthusiasts. Progress, hardware and software both, was just incredible. Who could have guessed that in less than 2 years mini-quads will evolve into main group of drones with such excellent flight characteristics. Just take a look at looptime. When I entered the hobby, standard looptime was 3500us (285Hz). Then, someone noticed that mini-quads fly much better when looptime is lowered and it started. Right now, standard looptime is 2000us (500Hz), while Betaflight starts with 1000us (1kHz) or even 500us (2kHz) in case of faster flight controllers.

Just by looking at numbers one might come to a conclusion, that looptime should be kept as low as possible and higher control loop frequency is better. Hey, 2kHz should be twice as good as 1kHz, right? One might even thing that it’s really about frequency. Well, this is both false and true: sometimes it is not about frequency, sometimes it is about frequency after all.

Continue reading PID looptime: why it is not only about frequency

JJPRO P175 PID tuning values

Like I stated before, default values for JJRC JJPRO P175 are flyable. But there is a huge difference between flyable and flying good.

I've spent few LiPos trying to make it fly just better than on stock values, and here is the most important fragment of CLI dump from my short tuning session.

Changes:

  • OneShot125 enabled
  • Gyro filtering improvements
  • Lower P gains
  • Lowered D gains
  • Raised I gains
  • Raised Rates
feature ONESHOT125

set i2c_highspeed = ON
set gyro_sync = ON
set gyro_sync_denom = 8
set gyro_lpf = OFF
set gyro_soft_lpf = 90

set p_pitch = 32
set i_pitch = 49
set d_pitch = 18
set p_roll = 32
set i_roll = 45
set d_roll = 18

set dterm_cut_hz = 80

set rc_rate = 90
set rc_expo = 65
set rc_yaw_expo = 0
set roll_rate = 70
set pitch_rate = 65
set yaw_rate = 55

Important: those settings apply only to 4S batteries. On 3S PIDs will be probably too low!

JJPRO P175 PID tuning values

Detecting Cleanflight PID tuning issues with Blackbox: gyro noise

After a short brake, let’s return to Blackbox series with new entry: “How much gyro noise is too much?”.

Almost all PID tuning tutorials states: reduce vibrations that affects gyroscope and accelerometer readouts. Yes, this true: any vibrations that appear during flight affects gyroscope and accelerometer readouts are bad and should be kept as low as possible. This can be done by balancing motors, propellers, using stiffer frame, adding dampeners, lowering LPF filters. But how much vibration induced gyro noise is too much? Let me answer with four Blackbox screenshots:

Super smooth gyro traces, no noise

smooth gyro traces

This is how it should looks like! Perfect trace. If it is archived without lowered LPF filters, then kudos for balancing everything!

Somehow noisy gyro traces

somehow noisy gyro traces

Little noise appears, but amplitude is low, everything is under control.

Noisy gyro traces

reasonably noisy gyro traces

Gyro noise is visible. It is not a problem yet. If it was a result of raised LPF cutoff frequency, extra noise might be worth lowered signal delay. I would start to think how to reduce it on a hardware level. Perhaps bearings are dying, or propellers should be rebalanced?

Extremely noisy gyro traces

extremely noisy gyro traces

This is how unflyable gyro noise level looks like! If you see have problems with flight performance, you know what is causing it. This have to be fixed ASAP before everything else.