Posts: 1,149 Threads: 50 Likes Received: 704 in 450 posts Likes Given: 1,189 Joined: Sep 2016 Reputation: 30 16-May-2017, 06:53 PM (This post was last modified: 31-May-2017, 02:47 AM by fftunes.) Short tutorial: How to adjust filters (work in progress) DISCLAIMERS: - how to set up / use external blackbox logging devices is not covered in this tutorial
- in future versions of betaflight, adjusting notch filters might become obsolete
- this is just the way i do it - there might be better ways. Discussion/tipps welcome
GENERAL WARNING: More filtering, i.e. filtering at lower frequencies as well as using wider notch filters, will increase the delay between the copter's real movement and the data fed into the PID loop, which can have a variety of negative effects on flight behaviour. I specifically do recommend to NOT use notch filters below ~140Hz. Further, with today's strong motors and possibly heavy props it is highly recommended to softmount fc and/or motors to reduce the amount of filtering needed. I will add more in-depth details in a second post below. What you need: Step 1 - Set up blackbox mode: - enable blackbox feature on configuration page
- in blackbox tab: choose the correct target for your flight controller (internal flash memory or SD card)
- in blackbox tab: choose an appropriate logging frequency (usually 1kHz is good enough)
- in modes tab: set blackbox to be used on a switch in order to enable/disable it in-flight
- in CLI: set debug_mode to "gyro" or "notch" (don't forget "save" after changing things) (warning: "gyro" means much more data)
Step 2 - Create a log file: - take off with a fully charged battery
- enable blackbox mode in-flight
- do a clean full-throttle punchout
- try to bring your quad down again without excessive propwash
- disable blackbox mode before landing
- depending on your hardware: export log in blackbox tab or take out SD card
- if using internal flash memory, you can erase it after exporting
Step 3 - Set up blackbox explorer: - open your log file
- click "Graph setup", choose the correct graphs (see pic below), optionally edit labels and display options
- press shift-key together with a number key from 0-9 to save this graph setup (number key to recall it)
Step 4 - analyze log data and adjust filters - follow steps in image below to see the noise spectrum of pre-notch or raw gyro graphs
- in configurator, adjust the gyro notch filters to match the noise peaks in the spectrum graph
- if the overall noise level is high, lower lowpass filters accordingly
- repeat step 2, then compare pre-notch or raw gyro to the normal (post-filter) gyro graphs
- repeat steps 2 and 4 until you think you hit the noise peaks well enough
Extra functions in Blackbox Explorer How to measure a frequency: If you see noise (waves) in the gyro lines you can find out the exact frequency of that noise. To do this, place the time marker at the start of a wave, press "m", then place the marker at the end of a complete wave to measure the time (either peak to peak, or zero-crossing to zero-crossing). The explorer will automatically display the frequency (see attached example pic below). How to analyze a specific part of the log: You can analyze the noise spectrum of only a specific region of the log file, for example in order to exclude landing impacts, or to see what happens under specific conditions or movements. To do this, use the "i" and "o" keys to mark the start and end of the region you want to analyze. This will create vertical white lines marking the "in" and "out" and grey out the rest of the log (see attached pic below). If you now click the spectrum analyzer button, it will only use that part to create the graph. Example pics pre- and post-filter: (pre-filter gyro roll) (post-filter gyro roll) Note: In this example only 1 gyro notch filter was used. Also, dterm notch was not adjusted at all. That's it, hope it helps. It may look like a lot, but once you have set up blackbox explorer it really isn't. Usually you can adjust notch filters in 2-3 runs. One thing to be aware of is that the PIDs should be set well enough to have the copter rev up fine, otherwise oscillations caused by PIDs could prevent it from reaching high rpm to begin with. Increasing TPA might help here. TO DO list: - add example pics of pre- / post-filtering
- add more links for blackbox explorer versions for different firmwares
- add more in-depth details regarding filter delays, different filter types, and d-term filters in 2nd post
Posts: 1,149 Threads: 50 Likes Received: 704 in 450 posts Likes Given: 1,189 Joined: Sep 2016 Reputation: 30 16-May-2017, 06:55 PM (This post was last modified: 17-Jun-2017, 09:58 PM by fftunes.) Some more details (to be continued, work in progress) Removing notch filters / changing filter lowpass types to reduce delay: Less filter delay means better response and better propwash handling. For this, you can make notch filters more narrow or remove completely (by setting frequency to zero), and possibly change lowpass filter types (via CLI) from biquad to pt1. WARNING: Be very careful when trying to change dterm lowpass type to pt1, especially on gyros that are capable of running at 32kHz. I've read several reports where quads instantly went full throttle after arming. It seems that the base noise on those super-sensitive gyros is too much to allow any less dterm lowpass filtering than a biquad-type. Oscar also made a post about this: http://intofpv.com/t-i-can-t-believe-it-...s-week-lol Comparison between wide and narrow notch filters (delay and magnitude) (pictures taken from rcg member r.a.v. from this post) Special Case: Resonating props (and no bb logger available) if you find that it's your props alone that are vibrating/resonating, there's ways to measure that frequency: From what i read, the app used in the vid is named simply "FFT spectrum analyzer". Then you could adjust narrow notch filters covering this frequency. • Posts: 2,416 Threads: 51 Likes Received: 1,861 in 1,175 posts Likes Given: 3,315 Joined: Mar 2016 Reputation: 74 Great step-by-step tutorial - can't wait to see more! Posts: 1,773 Threads: 30 Likes Received: 1,199 in 755 posts Likes Given: 714 Joined: Oct 2016 Reputation: 45 Thanks! This should be a good start to a very informative thread. For anyone who hasn't experimented with BB logging, you've shown that it's not nearly as complicated as it seems. Posts: 1,149 Threads: 50 Likes Received: 704 in 450 posts Likes Given: 1,189 Joined: Sep 2016 Reputation: 30 16-May-2017, 07:50 PM (This post was last modified: 16-May-2017, 07:53 PM by fftunes.) (16-May-2017, 07:31 PM)sloscotty Wrote: Great step-by-step tutorial - can't wait to see more! Thanks, hope it's useful enough for now... regarding actual filter delays i will have to dig through rcg betaflight thread for some pics and quotes of people who actually know what they're talking about which might take a while. (16-May-2017, 07:48 PM)RENOV8R Wrote: Thanks! This should be a good start to a very informative thread. For anyone who hasn't experimented with BB logging, you've shown that it's not nearly as complicated as it seems. And thank you too. Yes, do it once or twice and it becomes easy routine. Not too much to think of really. • Posts: 1,590 Threads: 89 Likes Received: 1,283 in 768 posts Likes Given: 1,274 Joined: Jan 2017 Reputation: 31 Great stuff I'll be putting it to the test on Saturday. carl.vegas Current Quads: Operational: Diatone GT2 200 In need of repair: Bumble Bee, tehStein, Slightly modified Vortex 250 Posts: 114 Threads: 12 Likes Received: 38 in 24 posts Likes Given: 1 Joined: Feb 2016 Reputation: 1 Hi! Is it crucial to enable it after takeoff and to disable it before landing? • Posts: 1,149 Threads: 50 Likes Received: 704 in 450 posts Likes Given: 1,189 Joined: Sep 2016 Reputation: 30 19-May-2017, 12:27 AM (This post was last modified: 19-May-2017, 12:29 AM by fftunes.) (18-May-2017, 11:27 PM)varkokonyi Wrote: Hi! Is it crucial to enable it after takeoff and to disable it before landing? Keep in mind the blackbox will record landing impacts which can be high amplitude low freq... as well as noise feedback while starting motors on the ground. It all will show up in the noise spectrum. Enabling/disabling in-flight also allows to keep log files smaller (faster exporting from internal flash memory). I'd say it's not absolutely necessary but makes reading the noise spectrum a lot easier. • Posts: 114 Threads: 12 Likes Received: 38 in 24 posts Likes Given: 1 Joined: Feb 2016 Reputation: 1 Okay, got it, thx. Makes sense. Exporting is not a problem, I have an SD card. Posts: 1,590 Threads: 89 Likes Received: 1,283 in 768 posts Likes Given: 1,274 Joined: Jan 2017 Reputation: 31 I dont have an option for pre filters but post filters it looked pretty clean so I just tuned pids and its flying great today carl.vegas Current Quads: Operational: Diatone GT2 200 In need of repair: Bumble Bee, tehStein, Slightly modified Vortex 250 • Posts: 1,149 Threads: 50 Likes Received: 704 in 450 posts Likes Given: 1,189 Joined: Sep 2016 Reputation: 30 20-May-2017, 11:59 PM (This post was last modified: 21-May-2017, 12:00 AM by fftunes.) (20-May-2017, 03:19 PM)Carl.Vegas Wrote: I dont have an option for pre filters but post filters it looked pretty clean so I just tuned pids and its flying great today In cli, set debug_mode = notch, for example • Posts: 1,590 Threads: 89 Likes Received: 1,283 in 768 posts Likes Given: 1,274 Joined: Jan 2017 Reputation: 31 I did... in fact... it was the very first command line I've ever sent to a quad but its flying great now so I am not as worried really. I have propwash issues but that's about it. carl.vegas Current Quads: Operational: Diatone GT2 200 In need of repair: Bumble Bee, tehStein, Slightly modified Vortex 250 • Posts: 1,149 Threads: 50 Likes Received: 704 in 450 posts Likes Given: 1,189 Joined: Sep 2016 Reputation: 30 Oh. I'll add in the guide that you also have to type the "save"-command after changing things in CLI. Also optimizing filter delay can make a big difference regarding propwash, but haven't written anything about this yet. Might try later today. Flying comes first, feel like i haven't been flying for ages... Posts: 1,149 Threads: 50 Likes Received: 704 in 450 posts Likes Given: 1,189 Joined: Sep 2016 Reputation: 30 31-May-2017, 02:42 AM (This post was last modified: 04-Jun-2017, 09:23 PM by fftunes.) Added "Extra funtions in Blackbox Explorer" in first post, and started on details in second post. Hard to dig through betaflight thread over there... i know the infos are somewhere. EDIT: Also added a warning regarding dterm lowpass filter type. Be VERY CAREFUL especially when changing it on gyros that are capable of running at 32kHz, i've read reports of quads instantly sky-rocketing upon arming after changing dterm lowpass type. • Posts: 1,590 Threads: 89 Likes Received: 1,283 in 768 posts Likes Given: 1,274 Joined: Jan 2017 Reputation: 31 19-Jun-2017, 02:35 PM (This post was last modified: 19-Jun-2017, 02:35 PM by Carl.Vegas.) BTW I never got back to this but I am curious... if I find very little noise, mostly in the very low end... Should I be considering greatly reducing or removing filters? Will it give me significant improvements in my flight characteristics? I'll try to post screenshots soon... My pre-filter looks much like post-filter... I'm thinking the nylon standoffs work better than I expected on my build... Then again, maybe I am doing something wrong... it's almost suspiciously clean if you ask me! carl.vegas Current Quads: Operational: Diatone GT2 200 In need of repair: Bumble Bee, tehStein, Slightly modified Vortex 250 • |