Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
The PID controller relays on gyro data. With too much noise reaching the PID input, the controller cannot function properly because all useful information regarding movement is submerged in useless noise. It consists of several different parts like electronic sensor noise (including voltage spikes from ESCs), resonances in frame/props/setup and motor vibrations. A common way to analyze the noise of a system is looking at the spectrum which is computed via Fourier transform. Spikes indicate common frequencies and are often seen as the main target for filters. Something to know about this: It is cumulative.
If you look at the spectrum from a 30s long flight consisting mostly of 30% throttle and only some punchouts with 100%, the cumulative spectrum will also mostly consist of noise that is happening at 30%, even though the vibrations during a punchout might have been stronger.
My guess is that this is most oftern the reason for mid-throttle oscillations: The filters (especially static notches!) are tuned to noise that happens at <50% throttle and everything is fine. Throttling up >50% changes the spectrum, the filters are less effective and consequently the signal to noise ratio at the PID controller goes down. This is even worse on a straight flight, since a steady quad means small signal for the gyro. Mid throttle oscillations are effectively happening within this window of uncertainty, resulting from noise on top of a flat signal.
If you think about it, you can also link it to propwash scenarios: Any time you provoke propwash, you do not only hit your own turbulences but also push the throttle which might increase noise and thus lower the signal quality that's passed to your PID.
The noise plot
- The colour plots represent the spectrum in relation to throttle input.
- The colour grading is on a logarithmic scale to improve details 100=1, 101=10, 102=100…)
- Each column is plotted with the same colour scale (gyro roll can be compared with gyro pitch/yaw… etc.)
- The ‘debug’ column is using what you have set in CLI. Use debug_mode=NOTCH or debug_mode=GYRO. Putting your esc telemetry there is pretty useless. 😉
- D-term does only exist on roll and pitch. Instead of D-term-yaw you get some statistics on your throttle usage. Useful to identify the length and style of flight.
- On top of the right column you see your filter settings. If there are blank entries of stuff is missing, please post the log. Different firmwares and even versions have different names for the same things.
- Below you see the average (non-cumulative) spectrum, more or less independent of throttle usage. This is similar to the spectrum analysis in Blackbox explorer but mostly independend of length and style of flight (as long as you use the full range of throttle during flight).
- The blue line is the average filter transmission as calculated form gyro/debug. This means it shows you what’s happening between your debug point and PI(D). In case it’s only a static notch, you will only see the static notch. If PT1 and dynamic notch are in between, you will see that (that’s the setting in this example).
- Since the method in this program is non-cumulative, the absolute values should be comparable between quads and even different filters, independent of flight time and log rate!
- The diagonal ‘line’ is the motor noise. In the example above the gyro roll and pitch show little motor noise <50% throttle. This is the realm of the dynamic notch and it does its job. For throttle >50% the motor noise approaches 500hz, which is the limit of the dynamic notch. Suddenly we see much stronger noise. In a cumulative analysis it would seem less relevant since, as the throttle distribution plot tells us, throttle was most of the time <50%.
- As written in the filter settings, a static notch on D-term was set to 260hz. In the D-term plots it is visible as dark, horizontal trench between 200hz and 300hz. This is perfect for flying at 20-30% throttle. At higher values the full gyro noise is passed to the motors which is only a good thing if you hate cold motors.
- The noise that hits the motor inputs was obviously produced by them in the first place. The engineer calls this ‘motor-heat-circle-jerk’.