Comments (39)
25$ per month
Not anymore. :)
from pidtuner.github.io.
you think one of these could work?
Blackbox is a feature of the flight controller.
Taycans use FCs without blackbox unfortunately, I guess due to high availability of PID presets for this class of drones.
If you want something similar, there are iFlight Protek 25 and 35, both have FCs with 8 MB of onboard flash which should be enough for a few flights.
from pidtuner.github.io.
What we are looking for as indeed the closest to a "step response" data.
here is some old logs with steps for tuning:
https://drive.google.com/drive/folders/1BkVSeszN4sz0ZQsZ-SJZ0V0VDp2F4yCp?usp=sharing
@spatzengr I'm sure you can provide more data)
from pidtuner.github.io.
Firmware in this context is the name of Betaflight target.
Betaflight supports a wide range of flight controllers equipped with various sensors and configured differently, so for each unique configuration there's a script which sets up a generic Betaflight installation.
In short, all three of them run Betaflight and all three of them have blackbox, so you're free to pick either one.
from pidtuner.github.io.
I have looked really fast, and it seems there is indeed a lot of interest for PID tuning for quads. Having said that, I have (physically) no hardware to start toying around. So we can start with this:
- Recommend some beginner hardware (cheapest quad that one can get where Cleanflight/Betaflight/INAV can be used). With this maybe I can open some gofundme to buy the hardware. Or maybe somebody here is interested in donating some directly.
- Help me find out information about the overall control problem (how many PIDs are involved, and what problem each of them solves).
- Help me find in software, exactly where are the PIDs implemented (I saw most of these tools are open source)
- How could I, given the hardware/software and after making some experiments, retrieve the data that comes in and out of the PIDs.
After taking actions on the points above I could make a video tutorial series on how to tune PIDs for quads using the pidtuner tool.
from pidtuner.github.io.
Hi,
How could I, given the hardware/software and after making some experiments, retrieve the data that comes in and out of the PIDs
You need flight controller with blackbox, here is log file example: https://drive.google.com/file/d/1b6vZMn3iw7ZSHXl1-pAcHbg8-kqShHCz/view?usp=sharing
You can view it through blackbox log viewer:
https://github.com/betaflight/blackbox-log-viewer
or pid toolbox:
https://github.com/bw1129/PIDtoolbox/releases
Also there is a tool to decode bbl files to csv format:
https://github.com/bw1129/PIDtoolbox/releases
Help me find out information about the overall control problem
there is PID + FF system with some improvements such as I-term relax, D-min(D-boost), PI-boost called antigravity, Absolute Control - calculating I-term constatn component. And It's not trivial to tune them all)
Recommend some beginner hardware
unfortunately besides a quad you'll need a bunch of pretty expensive equipment such as radio TX batteries chargers etc all round will cost you at least 300-500$
Help me find in software, exactly where are the PIDs implemented
you could start from pid.h pid.c files here:
https://github.com/betaflight/betaflight/tree/master/src/main/flight
from pidtuner.github.io.
My current patreon income is 25$ per month, so maybe in a year or two I could afford the hardware 🙃
In the meanwhile, the simplest, although not the best, is to try with existing closed loop data.
Let's just focus in one PID.
If any of you guys have test data where you drove a quad aggressively and have a log, we can do the following:
- Convert the log to CSV.
- Delete all columns except (time, pid input, pid output, pid reference).
- Post the resulting CSV here, along the value of the PID gains used in the experiment.
With this data we can start some discussion without the need of hardware.
from pidtuner.github.io.
You need flight controller with blackbox, here is log file example: https://drive.google.com/file/d/1b6vZMn3iw7ZSHXl1-pAcHbg8-kqShHCz/view?usp=sharing
You can view it through blackbox log viewer:
https://github.com/betaflight/blackbox-log-viewer
or pid toolbox:
@mituritsyn I have poked around your log file example, converted to CSV, and tried to match the column names to the betaflight source code but have hard time matching them.
What we need for PID tuning, from the source code point of view, is the gyroRate
variable, the pidData[axis].Sum
variable and the time. Since we have closed loop data, it would be also useful to have the currentPidSetpoint
.
Form what I have seen, there are PIDs for FD_ROLL
, FD_PITCH
and FD_YAW
axis, but have not been able to match to the log columns:
H Field I name:loopIteration,time,axisP[0],axisP[1],axisP[2],axisI[0],axisI[1],axisI[2],axisD[0],axisD[1],axisF[0],axisF[1],axisF[2],rcCommand[0],rcCommand[1],rcCommand[2],rcCommand[3],setpoint[0],setpoint[1],setpoint[2],setpoint[3],gyroADC[0],gyroADC[1],gyroADC[2],debug[0],debug[1],debug[2],debug[3],motor[0],motor[1],motor[2],motor[3]
I traced most of the PID source code to the @etracer65 github user, maybe he can help us out.
from pidtuner.github.io.
axisP[0],axisP[1],axisP[2],axisI[0],axisI[1],axisI[2],axisD[0],axisD[1],axisF[0],axisF[1],axisF[2]
here is roll pitch yaw PIDs
setpoint[0],setpoint[1],setpoint[2],setpoint[3]
roll pitch yaw throttle setpoints
Not sure about gyroADS[ ] values. Most likely they are filtered gyro rates. what am I sure about is that debug[0-3] is gyro prefiltered values for roll pitch and yaw accordingly
from pidtuner.github.io.
here is what I found in dosc folder: gyroADC/8192*2000 = deg/s
from pidtuner.github.io.
Browsing the code a little further found out where the variables are logged, it is a shame since it seems the data is truncated to integers before being logged. This is not ideal for PID tuning.
It also seems that pidData[axis].Sum
is not being logged, but their individual P
, I
and D
contributions are, so that is fine because we can reconstruct the PID
output.
In the meanwhile, we need blackbox logs examples where data was recorded, ideally indoor or with no wind or external disturbances. Preferably with badly tuned PID gains, which give better information. Also trying to shake the drone during the experiment, move it around to get more dynamic information.
I found this simulator that appears to be betaflight compatible:
Anybody recommends it? Has a license?
from pidtuner.github.io.
the data is truncated to integers before being logged
probably this is needed to further data compression. In BF pids are working at 1-8kHz rate and even partial logging requre huge bandwith. We tune pids via blackbox log viever analisys and it's pretty enought.
Also trying to shake the drone during the experiment
pretty bad idea to shake racing drone during flight)
it's best sim for drone racers but as i noticed it hasn't good enought gyro noize and pid simulation so it doesn't fit for pid tune simulation. here is one BF compatible sim: https://store.steampowered.com/app/410340/Liftoff_FPV_Drone_Racing/https://store.steampowered.com/app/410340/Liftoff_FPV_Drone_Racing/
we need blackbox logs examples
it's a rainy week so I cant provide more data
from pidtuner.github.io.
Sorry, I did not make myself clear, what I mean with "shake" is not with the hand or anything physically, I mean moving the drone around with the RC. And ideally indoors, to avoid external perturbations (link wind).
I been looking around how people do it and some have the right idea, like these guys:
What we are looking for as indeed the closest to a "step response" data.
@mituritsyn, @naorunaoru, you think one of these could work? They list Betaflight as firmware, what I am not sure is if I can save blackbox logs with it or if I need to buy something extra.
- https://www.diatone.us/collections/taycan-series/TAYCAN-Series
- https://es.banggood.com/search/diatone-taycan.html
from pidtuner.github.io.
@bw1129, I saw from your video you are an expert in quad PID tuning, care to contribute? 🙂
from pidtuner.github.io.
from pidtuner.github.io.
you think one of these could work?
These ones are specialized for cinematic filming. They fly with very low turn rates and doesn't needed in sharp tuned pids at all.
I'd prefer something more agressive) for example:
https://banggood.com/Diatone-Roma-F5-Lite-4S-5-Inch-Freestyle-FPV-Racing-Drone-PNP-CADDX-RATEL-Cam-MAMBA-F405-DJI-Lite-FC-400MW-VTX-40A-ESC-2450KV-Motor-p-1740586.html
from pidtuner.github.io.
@mituritsyn, @naorunaoru, thanks for the recommendations.
The iFlight Protek seems better for me because I plan to do indoor tests to do research. First because, as in @bw1129 video, identification tests are cleaner when there are no external disturbances (no wind) and all non-linearities are minimized (Feedforward and other non-standard PID featured disabled).
I saw from the banggood listings, that they sell the drone + receiver combo, I suppose this means I must also buy a matching transmitter, could you please help me choose the cheapest transmitter-receiver combo that will do the job? Note I am not looking for the best hardware, most performance, just the cheapest that can do the job (Betaflight PID configuration and Blackbox).
The idea would be to provide a step-by-step procedure for PID tuning roughly as follows:
- How to configure Betaflight parameters to prepare for PID tuning test.
- How to perform indoors tuning test.
- How to pre-process blackbox log file to prepare for PID tuner tool.
- How to use PID Tuner tool to obtain PID gains.
- How to convert standard PID gains to Betaflight PID gains (Betaflight does not use standard gains, it performs scaling and other transformations).
- How to validate good tuning.
If I succeed in defining these steps in a cheap drone, they should generalize to any other drone using Betaflight.
Steps 1,2 and 6 are pretty much already described in @bw1129 video. His tool is very good in showing an analyzing closed loop step response (setpoint to gyro, which is the result of PID tuning). What we need for PID tuning (get good gains in one step) is obtaining an open loop response (PID output to gyro).
Thanks for your help, @mituritsyn I am going to take a look at your logs as soon as I can.
from pidtuner.github.io.
could you please help me choose the cheapest transmitter-receiver combo that will do the job?
Radiomaster TX12 is hard to beat for the price. If you want to go lower, there's Jumper T-Lite. Even lower — BetaFPV LiteRadio, but be aware that it comes with either Frsky or Bayang compatibility and you don't want the Bayang. Also it's a bit cumbersome to set up because there's no screen.
Other options may include Radiomaster TX16 or a comparable offer from Radioking, the first will serve you well, the second may be just enough to get by.
If you are opting for a remote with reduced multiprotocol module (often marked as CC2500), you can pair it basically only with Frsky D8 and D16 compatible receivers. Sure, Futaba is on the list too, but their receivers are prohibitively expensive.
from pidtuner.github.io.
OK, so to confirm, I can get started with these two?
- iFlight Protek35, should I get
FrSky R-XSR
orFrsky XM+
receiver?
from pidtuner.github.io.
Hi @mituritsyn, thanks for the logs, I only managed to get some slightly useful information for the Yaw loop, because it is the only one that had D
gain disabled during the test.
I am sure if we make a Basement Tuning blackbox log with Betaflight settings as in @bw1129 's video, we could get a much better fit, which would yield optimal PID gains.
from pidtuner.github.io.
FrSky R-XSR or Frsky XM+
xm+ should be more than enought for indoor flight
Yaw loop, because it is the only one that had D gain disabled during the test
Hi, there is no D-gain for yaw axis at all, exept one experimental mode. And it is very bad idea to fly with zeroed D gain on pitch or roll... This was accessible in older versions, but since v.3.5 I've got strong oscillations with 0 D so its impossible to fly.
from pidtuner.github.io.
And it is very bad idea to fly with zeroed D gain
Perfect, that's the wait the test should be done, if you watch @bw1129 's video, he mentions:
I am just trying not to hit the walls
These zeroed D gain are just for the "step response" experiment, once we get that blackbox log, the PID Tuner should give the optimal PID gains (including a non-zero D gain for pitch and roll).
Thanks for the info.
from pidtuner.github.io.
I have tried to buy from bangood, but none of my cards worked on the site.
I am looking now at aliexpress where I have bought stuff before, but then got confused, because even though all models below support blackbox, they list different firmware:
- iFlight iH2 HD Whoop :
Firmware:BETAFLIGHTF4
- iFlight ProTek25 HD :
Target:IFLIGHT_F411_PRO
- iFlight ProTek35 HD :
FC Firmware:IFLIGHT_F745_AIO
I am leaning on buying the first one, since is the only one explicitly listing Betaflight, or are all the same? These specs are really confusing for a drone noob.
Appreciate the help
from pidtuner.github.io.
@pidtuner you dont need hd version till you gonna buy DJI goggles:
https://aliexpress.ru/item/4000829726749.html?&sku_id=12000018678228827
from pidtuner.github.io.
Thanks guys, I already ordered the iFlight ProTek25
with Frsky mini XM RX
for a very fair price (150eur), it takes a couple of weeks to arrive though.
The BETAFPV
transmitter I will buy later from amazon (arrives faster).
Seems I need to watch a lot of tutorials just to be able to setup it up. Its an expensive and complicated hobby you guys have. If you know some setup tutorials for total noobs, I would highly appreciate.
from pidtuner.github.io.
@pidtuner probably this will be the best solution:
https://a.aliexpress.com/_mOfeJ3R
It has ducts for safety indoor. 128Mb flash for logs, and it comes wo fpv equipment
from pidtuner.github.io.
I already ordered the iFlight ProTek25
My congratulations. Don't forget batteries and charger)
These zeroed D gain are just for the "step response" experiment
I watched the video, found nothing new for myself. I didn't understand where in that video you saw the zeroing of the D component. There's nothing like that. He recommended turning off feed forward and dmin. But nothing about the need to zero D-gain.
from pidtuner.github.io.
My congratulations. Don't forget batteries and charger)
OMG this is going to ruin me . What do I need to know about battery? The product specs lists 4S
, will this one work? What is the matching charger? I might have to wait till next month to buy transmitter and battery pack, already out of monthly expenses.
from pidtuner.github.io.
@pidtuner charger
the battery you need, or any other 4s 650-850mAh and at least 70C from cnhl, gnb, tattu. best prices for cnhl at their official site
from pidtuner.github.io.
@mituritsyn thanks, about the zeroing D-gain, I got confused, did not see it in the video but in a blog post:
Find the "The Tuning Process" section, in the post they explain how to tune using a "trial and error" approach, increasing gains gradually and re testing for every new gains combination. My idea would be to tune in one go.
from pidtuner.github.io.
this is pretty old guide for tool that has no dev activity since 2018
look at this guide, it is for hand tuning but also could be usefull https://drive.google.com/file/d/1WxgSUsG6UnvXjyxJSsAdw9iqoO21Ddmq/view?usp=sharing
from pidtuner.github.io.
Well, I am already committed to this
from pidtuner.github.io.
@naorunaoru @mituritsyn maybe you guys can help me out with this one. I bought the Tattu 850mAh 14.8V battery for the iFlight Protek 25.
Now I also bought a TookitRC charger that let's me select Voltage and Amperage to charge each cell. The amps I get, the battery manual says "Do not charge at more than 1C", so if 850mAh then charge max at 0.8A, so I use 0.5A because next one is 1A which would be too much.
But the Voltage I do not get because the battery model says 14.8V, but the manual says:
- Store Range 3.8V - 3.9V (So times 4 this translates to 15.2V - 15.6V).
- Normal Range 3.3V - 4.2V (times 4 is 13.2V - 16.8V).
So what voltage to I charge to? The model name says 14.8V, but the normal range in the manual says max 16.8V?
Even the storage range is larger than the 14.8 from the model name. so I am totally confused. ToolkitRC let's me choose 4.20v, 4.35v, 3.85v and 3.60v. I could use some guidance here, I don't wanna mess up because I read one should be careful with these batteries.
Thanks.
from pidtuner.github.io.
model says 14.8V
li-po has nominal 3.7V so x4=14.8 V, fully charged it will be 4.2x4=16.8 V
Normal Range 3.3V
3.3 is too low try not to discharge it lower than 3.5 or better 3.7
Do not charge at more than 1C
1C is the best for long battery life, but nothing bad should happen if you'll choose 1A for your battery
from pidtuner.github.io.
Thanks, then I will charge to 16.8 V when I make the first flights, then 15.4 V for storage. Hope nothing gets damaged,
Everything got delayed because I got the taranis q7 Tx, because I found a lot of tutorials for it, so I thought it might be simpler to setup. In all tutorials I saw it used AA batteries, so I bought high capacity rechargeable. But when mine arrived,it had a slot for a special battery.
So I thought I have to buy one more battery plus one more charger 😒 but then I found you can actually buy the AA tray for the taranis, but now I have to wait 2-3 more weeks until it arrives 🥴
from pidtuner.github.io.
plus one more charger
you doesn't need it. your charger is universal and can charge all 1-4s li-po. So for q7 you need 2s li-po with xt60 or other plug, but you'll need adapter
from pidtuner.github.io.
I have no more budget, so I will wait for the AA tray for the taranis. Still it seems it will not be trivial to get up going according to this guy who has the exact same setup ad I do 🤒:
https://www.youtube.com/watch?v=4XBVjnZjrtY
from pidtuner.github.io.
be trivial to get up going according
all should be pretty easy if you can follow the instructions and not blame iflight Instead of frsky as guy from the video)
from pidtuner.github.io.
Hey guys, here is some presentation to understand how the PID Tuner works, maybe is helpful. I am developing some algorithms to be able to use later with Betaflight, but first I am testing them on other (easier) platform. Will keep you updated.
from pidtuner.github.io.
Related Issues (15)
- Idea: Other algorithms besides PID Velocity Form? (Position Form) HOT 7
- Can't change Selected Time Range HOT 2
- Make clearer how one updates the graph after changing a gain value HOT 1
- entring the sample data HOT 4
- desimal point HOT 4
- Questions about Input Limitations and "du_Lim" HOT 2
- PID Tuner could not find any steps in the data HOT 1
- Question about sys id and documentation HOT 4
- forum registration fails HOT 2
- Where is the math? HOT 9
- support PX4 autopilot flight logs HOT 5
- How to tune a Soft-PWM tuned heater behind an SSR HOT 4
- PID controller saturation HOT 1
- PID Tuner no longer working... HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pidtuner.github.io.