Thread Tools
Aug 21, 2015, 11:15 PM
Registered User
Thread OP
Quote:
Originally Posted by RC Slater View Post
Anything here I can improve?
Everything looks pretty good. If you want to experiment with raising gyro_cut_hz, you probably can, although you may not be able to disable it entirely. If you experiment with that, please follow up and let us know your results, and maybe post a log with gyro_cut_hz=0 for comparison.

Only suggestion I have is consider reducing roll P gain just the tiniest bit. Maybe 0.1 or 0.2 at most. See the video for details.

Blackbox Log Analysis: RC Slater (11 min 3 sec)
Sign up now
to remove ads between posts
Aug 22, 2015, 05:16 AM
Registered User
Quote:
Originally Posted by joshuabardwell View Post
No video response, but I do want to address this specific question.

There are basically two things you can do to get rid of noise. First, you can eliminate the source of the noise, which on a multirotor is almost entirely the props and motors. So if you want to reduce noise, balance your motors at the very least, and if you are a real masochist, balance your props too. But if you fly like most mini quad pilots, you're going to break so many props that balancing them isn't going to be worth your time.

Check your accelerometer on the bench using the Motors tab. Run the throttle slowly up and down again, then check the peak-hold values. If you have more than about 0.05G on any axis with the prop off, or more than about 0.30G on any axis with the prop on, I would call that excessive and possibly indicative of a mechanical issue that needs addressing (bad bearing, bent shaft, etc...). Vibration can also be caused by ESC settings, such as motor timing, but that's a bit of a wormhole that you may not want to go down.

Second, you can filter. If you want to get rid of yaw noise, reduce gyro_cut_hz and/or gyro_lpf. You already have your gyro_cut and pterm_cut pretty heavily filtered. I see the part at about 8-9 seconds in the log where you peg the throttle and get a lot of noise, and your P term kind of goes crazy. Consider using more TPA to address this, perhaps. Your TPA breakpoint is lower than typical. Possibly you could get better results by raising your TPA breakpoint to maybe 1600 or 1650, and then lowering your P gain to a level that lets you avoid oscillations when the throttle is below that point. That way you can raise the TPA amount a little if you want to, without clamping P at lower throttle ranges.

There has been some discussion about having separate filter values for the pitch, roll, and yaw axis. If you spend enough time looking at BB logs, you'll see that the three axes are usually different in the amount of filtering that they optimally might need. But if my memory is correct, that was judged to be too complex and potentially confusing, and it was dropped.
Thank you for your feedback, much appreciated

Regarding to Pterm spikes at full throttle I also think that this could be fix with TPA but I have read in cleanflight that TPA only affects Pitch and Roll. We sure need to control yaw TPA as well.

Maybe this could be a good feature to have in Boris Betaflight because I have seen many people with this same problem (yaw noise at high throttle) and increasing TPA will keep those spikes down.
Aug 22, 2015, 05:40 AM
Registered User
Hi Joshua, thanks for this thread which is very interesting.
I am retuning one of my mini quads from scratch with Betaflight (version from 10 or 14 days ago roughly), BlHeli 14 and Gemfan 5045. It is a ZMR 250 with Afro 20A, DYS 1806 2300 KV, running on 3s.
PID values I am using now are way lower than I normally use, however I probably was running values too high before.

Since it is the beginning of the tune ( I only did 1.5 batteries LOS / FPV tuning before starting BB) there are definitely things to work on, and I am focusing on a single issue right now: the overshoot on roll. This happens in full rolls and also partial rolls, I have raised D term and lowered P term but it's still there.
In the log file I am running 3 sets of PIDs, the first one being the lowest and 3rd being highest (3rd one has P and D about 20% higher than first one).

This analysis is a BLIND test as I will not disclose my PIDs until you had a look

So question: why do I get such overshoot on roll, what should I change?

gyro settings:
gyro_lpf = 256
gyro_cut_hz = 60
pterm_cut_hz = 40
dterm_cut_hz = 13
PIDC: 1

PS: I have caught up on the Betaflight thread and will be flashing newest version and trying gyro_lpf = 188
So before I forget what the PIDs were, I need to write them here !

All profiles:
Pitch PID: 4.7 / 0.035 / 0.035
Yaw PID: 7.0 / 0.030 / 0
Roll:
profile 0: 3.0 / 0.027 / 30
profile 1: 3.3 / 0.027 / 33
profile 0: 3.6 / 0.027 / 36

After looking at some other logs it seems like some overshoot on sharp roll inputs is normal, it appears on the graph but might no be noticeable on video ?
So I may be trying to fix something that can't be fixed? Is this correct?
Last edited by NicoLoco; Aug 22, 2015 at 08:51 PM.
Aug 22, 2015, 12:32 PM
Saved By The Lost Model Buzzer
Quote:
Originally Posted by joshuabardwell View Post
Everything looks pretty good. If you want to experiment with raising gyro_cut_hz, you probably can, although you may not be able to disable it entirely. If you experiment with that, please follow up and let us know your results, and maybe post a log with gyro_cut_hz=0 for comparison.

Only suggestion I have is consider reducing roll P gain just the tiniest bit. Maybe 0.1 or 0.2 at most. See the video for details.

https://www.youtube.com/watch?v=HaJsqHctd18
Hey thanks! Excellent comments about the blackbox logging rate and filters

...One thing though, I'm not certain you were actually looking at my log.

The one I linked to: https://www.dropbox.com/s/0l7p78qpwl...00011.TXT?dl=0

...is 5:46 in length only has one arming sequence and therefore no dropdown box in the viewer. I saw you select a different log in the dropdown in the video, so I don't think it was mine.. Maybe that's why it wouldn't sync up with the video?

Also, I finished uploading the video with the log overlay:
QAV Log Flight with Blackbox Overlay (5 min 48 sec)
Last edited by RC Slater; Aug 22, 2015 at 12:39 PM.
Aug 22, 2015, 12:36 PM
Saved By The Lost Model Buzzer
Quote:
Originally Posted by RC Slater View Post
Hey thanks! Excellent comments about the blackbox logging rate and filters

...One thing though, I'm not certain you were actually looking at my log.

The one I linked to: https://www.dropbox.com/s/0l7p78qpwl...00011.TXT?dl=0

...is 5:46 in length only has one arming sequence and therefore no dropdown box in the viewer. I saw you select a different log in the dropdown in the video, so I don't think it was mine.. Maybe that's why it wouldn't sync up with the video?

Also, I finished uploading the video with the log overlay: https://www.youtube.com/watch?v=Ly4ga2Kp9aQ
One extra question too. On my pitch axis, you can see in video and log, that the i value stays very consistently above the horizontal axis? It also appears to dominate the pid sum. I assume this is not normal. Do I need more P on pitch to keep the error down? Or do I need to decrease i on pitch axis?
Aug 22, 2015, 03:33 PM
Registered User
Thread OP
Quote:
Originally Posted by RC Slater View Post
One extra question too. On my pitch axis, you can see in video and log, that the i value stays very consistently above the horizontal axis? It also appears to dominate the pid sum. I assume this is not normal. Do I need more P on pitch to keep the error down? Or do I need to decrease i on pitch axis?
It's normal to see I value nonzero during flight, especially on pitch axis. Imagine you have a copter that has a CG aft of the motor centroid. So when you hover flat, the copter will tend to pitch backwards if the motors are all even. The I term compensates for this by going positive. The back motors spin faster and the copter hovers flat.

Even if your CG is perfect, during any flight condition, there will be uneven aerodynamic forces on the copter. Typically, during forward flight, I term is positive. That's normal.

Roll and yaw I term are usually close to zero during forward flight. For whatever reason, there tends not to be very much off-center force on those axes. If you had one prop that was slightly shorter than the others, or flexing a bit more, then you might see yaw I go non-zero during hover or forward flight. That sort of thing.

If you have a copter with an assymetrical body style, or off-center weight, you may have non-zero roll I term. But most copters are symmetrical across the roll axis even if they're not symmetrical across the pitch axis.
Aug 22, 2015, 03:34 PM
Registered User
Thread OP
Quote:
Originally Posted by RC Slater View Post
...One thing though, I'm not certain you were actually looking at my log.
Oops.

Aug 22, 2015, 03:59 PM
Saved By The Lost Model Buzzer
Quote:
Originally Posted by joshuabardwell View Post
It's normal to see I value nonzero during flight, especially on pitch axis. Imagine you have a copter that has a CG aft of the motor centroid. So when you hover flat, the copter will tend to pitch backwards if the motors are all even. The I term compensates for this by going positive. The back motors spin faster and the copter hovers flat.
Makes a lot of sense! This particular flight had a huge honkin 2200 mah 4s battery hanging out the end of it.

Also, thanks for makin me look good with someone else's log!
Aug 23, 2015, 12:54 AM
Registered User
zenman's Avatar
Quote:
Originally Posted by Nicoduf View Post
....
After looking at some other logs it seems like some overshoot on sharp roll inputs is normal, it appears on the graph but might no be noticeable on video ?
So I may be trying to fix something that can't be fixed? Is this correct?
I've been taking a close look at this and it seems that increasing D does decrease the amplitude of the oscillations but does not eliminate them. At the same time increasing D will also increase the frequency and duration of the oscillations. Not exactly what I would expect.

I don't know if this has something to do with the filtering, rc smoothing, or I just never noticed it before, since I always try to keep my D low. I was experimenting with higher D and found it kind of was making things worse.
Maybe its something to do with Kiss esc which seems to need low P. I have P set around 0.5 but it may be it needs to be even lower.
I think keeping the oscillations to a minimum of 2 or 3 with the right D setting is enough and will not be to noticeable on video.

These screenshots are at different D settings. The difference in amplitude is not really noticeable as the gyro trace is probably not drawn to scale or is capped somehow, but the amplitude is about 2 times bigger on the the first pic compared to the others.

Lux
P 0.54
LPF 188
gyro_cut_hz = 80
p_term_cut_hz = 40
d_tern_cut_hz = 10

In the first picture with D of 6 the oscillation is at 12 hz In the last with D of 40 it is at 30 hz
btw: I normally keep D around 18
Last edited by zenman; Aug 23, 2015 at 01:20 AM.
Aug 23, 2015, 01:24 AM
Registered User
Quote:
Originally Posted by zenman View Post
I've been taking a close look at this and it seems that increasing D does decrease the amplitude of the oscillations but does not eliminate them. At the same time increasing D will also increase the frequency and duration of the oscillations. Not exactly what I would expect.

I don't know if this has something to do with the filtering, rc smoothing, or I just never noticed it before, since I always try to keep my D low. I was experimenting with higher D and found it kind of was making things worse.
Maybe its something to do with Kiss esc which seems to need low P. I have P set around 0.5 but it may be it needs to be even lower.
I think keeping the oscillations to a minimum of 2 or 3 with the right D setting is enough and will not be to noticeable on video.

These screenshots are at different D settings. The difference in amplitude is not really noticeable as the gyro trace is probably not drawn to scale or is capped somehow, but the amplitude is about 2 times bigger on the the first pic compared to the others.

Lux
P 0.54
LPF 188
gyro_cut_hz = 80
p_term_cut_hz = 40
d_tern_cut_hz = 10

In the first picture with D of 6 the oscillation is at 12 hz In the last with D of 40 it is at 30 hz
btw: I normally keep D around 18
Looking at your screenshots, the oscillations are obvious a would indicate P being too high. Unless this is at high throttle, in which case you could try TPA instead?
Anyway this quite different from my issue which is a single overshoot.
Aug 23, 2015, 01:38 AM
Registered User
zenman's Avatar
Quote:
Originally Posted by Nicoduf View Post
Looking at your screenshots, the oscillations are obvious a would indicate P being too high. Unless this is at high throttle, in which case you could try TPA instead?
Anyway this quite different from my issue which is a single overshoot.
It is at hover speed, P is at 0.540 ... quite low.
I will be trying going lower.

Have you looked at it in blackbox?

Although it looks pretty bad in blackbox , it's not that noticeable on video when it only over shots 2 or 3 times. Keep in mind, I'm stopping the rotation quite hard ... as fast as I can actually. If you stop it more gradually it will not overshoot much at all.
This is probably showing that there are physical limits that no amount of tuning can completely control.
But I'll do my best
Last edited by zenman; Aug 23, 2015 at 01:47 AM.
Aug 23, 2015, 06:19 AM
EU drones
Genivos's Avatar
To get back to the analyzing video and your remarks, I have been busy testing yesterday.

Right now I changed 3 things which can be seen in the logging.
Logging 1, changed DTERM_CUT_HZ to 10 only
Logging 2, changed DTERM_CUT_HZ to 10 and Roll P to 1.2 (was 1.1)
Logging 3, changed DTERM_CUT_HZ to 10 and Roll D to 28 (was 31)

Logging 2 and 3 I did to see the difference if I will change either P or D. I did not found more vibrations with slightly higher P and to my own feeling it flew it a bit more pleasant to have slightly higher P compared to lower D.

Also I found out motor 1 is still maxing out. One flight, no log included about that flight though, it tumbled suddenly forward (right back went up). In logging I could see the following:
- NO failsafe;
- Motor 1 (!) suddenly maxing out in straight flight while throttle was on 1494;
- Immediately tumbled after that since the other motors couldn't correct it, it kept maxing out;
- Before the flights from yesterday (and this logging and this specific flight) I changed props;
- After this flight the prop from motor 1 was not loose;
- Motor 1 was cool in temperatur.
I immediately lowered throttle and luckily landed in high grass. No damage.
My conclusion after this is, since throttle signal stayed at 1494, that the ESC has a problem. I changed the ESC and hope to see today a good result.

It might be that this defective (as I think from my own conclusion) ESC might have influenced the graphs as well, maybe not much but still. We'll see on the next flight I will leave DTERM to 10 and Roll P to 1.2 for now.

NOTE that I went back to BetaFlight from August 13. That day I had no problems with corrupt bb logging files. This time I also had no corrupt files, only very rare it dropped some data I noticed (ratio 1:2 with looptime ~600).

Quote:
Originally Posted by Genivos View Post
Hello Joshua,

Great to see this thread. Myself I'm also trying to analyze the blackbox logs. If you find time to look at my log and give comment on it, I'd be very thankful.
As far as I can judge my own logs I don't see much wrong. Not looking solely only at the log but also how it flies. If there's some improvement to make, just curious to know what it could be.

Video from this log with details about the quad setup. Please don't mind the sound and also better turn down volume, I forget to remove it (again):
https://www.youtube.com/watch?v=RtIJCFmS9Hk

I was trying lower dterm_cut_hz values for testing purposes but unfortunately for some strange reason my blackbox logger decided not to log correct anymore. Don't know why, last Saturday I had totally no issues. In this log you can see as well it missed some parts unfortunately. Only thing I could think of and what I overlooked before installing the SD card, was to use the SD card formatting tool. This I did last night after the flights and it will show next time if it will log correct or not (note that my CLI settings were exactly the same as Saturday when it was working correct, so that can't be it was my conclusion).
Quote:
Originally Posted by joshuabardwell View Post
Overall, looks like a very good tune with little to complain about. Definitely make a snapshot of this config as you continue to tweak the last nth percent out of the tune. Sometimes I tweak and tweak trying to make things better, and by the time I realize I have made them worse, I kind of forget what the config was the last time it was really good.

Copter maintains pitch attitude on a strong punchout. Pitch I gain is not too low.

Just a tiny bit of slow wobble on turns. P term on roll looks small. Possibly could stand to increase roll P. If you can't do that, then consider decreasing roll D so that D is more proportional to P.

Could probably use even more dterm filtering, as long as flight results are acceptable. Your d term doesn't look very noisy, but it is not as smooth as some of the results I've seen either. Try going all the way down to 10 and see what happens.

https://www.youtube.com/watch?v=9zmZZPAsTVU
Last edited by Genivos; Aug 23, 2015 at 06:23 AM. Reason: forgot to add the zip with logs
Aug 23, 2015, 07:50 AM
Registered User
I also wanted to have a "profile" feature in the log viewer, so I didn't have to re-select each channel every time.
I have a workaround: just use several web browsers with different settings !
At the moment I use chromium to look at the thickness of gyro traces + motors, firefox to look at the roll PIDs, and Opera for Pitch PIDs
You can open the same file with several browsers at the same time (it looks like the log viewer reads the file then releases it and doesn't care if you remove the SD card anyway).

PS: At looptime 1000 do I need to run blackbox_rate_denom = 2 ?
Last edited by NicoLoco; Aug 23, 2015 at 08:23 AM.
Aug 23, 2015, 08:02 PM
Registered User
whoisthat's Avatar

PID hell


Hi Joshua - I've been wrestling with PIDs in general since I started into mini quad flying. Your videos have been a great help, but I still feel like I'm missing a a few things. (tpa's relationship to pids looptime in general etc) I read, watch videos, test and trying to wrap my head around it all - but no such luck. Now with the betaflight build and adding all these filters on top of everything else complicates it even more!!


I've got one of my quads tuned pretty well (i think) but the other (files attched here)- I just cannot get it locked in and have lots of angry pac-mans - I need some help!

Quad specs:
zmr250
RG20a ESCs
Cobra 2206 2100kv motors
Naze full

attached is dump of my PIDs and my data file from blackbox as well as.

There's much much much less rapid (fast) oscillations on this set up now, but my Motor 1 is still getting pretty warm as well as the ESC - almost too hot to touch. The motors and esc's typically come down cool or barely warm to the touch.

Thanks in advance for your help
Aug 23, 2015, 09:36 PM
Registered User
Thread OP
Quote:
Originally Posted by Genivos View Post
Also I found out motor 1 is still maxing out. One flight, no log included about that flight though, it tumbled suddenly forward (right back went up).
Bear in mind that the maxxed out motor may indicate that the motor had some kind of mechanical or electrical problem that caused it to stop generating thrust. If that were to happen, the arm would drop and the PID controller would increase thrust on that motor, eventually to max.

Just saying there is a bit of a chicken and the egg here. Did the motor need to go to max, and the other motors couldn't keep up? Or did the motor fail, and the PID controller set the throttle output to max as a result? My gut is that the second one is more likely to be correct. Maybe ESC shutdown or sync loss or something?


Quick Reply
Message:

Thread Tools