This commit is contained in:
Stavros Korokithakis 2021-01-07 19:32:11 +02:00
parent fc17f838e7
commit defad9996c
No known key found for this signature in database
GPG Key ID: 26EA345ECD4C2A63
9 changed files with 42 additions and 28 deletions

View File

@ -8,6 +8,7 @@ insert_anchor_links = "right"
Click on a link in the list below to go to that page:
1. [A simple guide to PID control](../../drone-stuff/a-simple-guide-to-pid-control)
1. [General RC tips](../../drone-stuff/general-rc-tips)
1. [Getting uninverted SBUS on a no-name FrSky-compatible receiver](../../drone-stuff/getting-uninverted-sbus-on-a-no-name-frsky-compatible-receiver)
1. [Getting uninverted SBUS/SmartPort on the FrSky XSR receiver](../../drone-stuff/getting-uninverted-sbus-smartport-on-the-frsky-xsr-receiver)

View File

@ -0,0 +1,33 @@
+++
title = "A simple guide to PID control"
weight = 0
sort_by = "weight"
insert_anchor_links = "right"
+++
I made some changes to my quadcopter the other day for [a new photography project I'm working on](https://www.makerfol.io/project/m8xrLUp-light-painting-with-drones/).
Unfortunately, it turned out that it wasn't good enough, and that I'd have to tune my [PID loop](https://en.wikipedia.org/wiki/PID_controller), which I knew nothing about.
After watching a few videos and reading a few things, I learnt enough to be dangerous, and to hopefully be able to explain the concepts simply, so I want to write them down here before I forget.
Basically, a PID loop can be thought of very simply as an equation that takes your current state as input and gives you what you need to do to reach a desired state as output.
For example, if you had a radiator and wanted to heat a room, the PID loop would take the current temperature as input and tell you how high you needed to set the radiator on a 0-100% scale to achieve a desired temperature.
The PID loop has three components, and to tune it you need to set three weights that you multiply each parameter with.
That means that it's basically `output = P*prop, + I*intgr + D*deriv`, where the terms are explained below:
* **`P` - proportional**: This is the weight of the difference between the current position and the desired position.
What this says about the radiator is "we're still far away, we need more heat!", so the more P you set, the higher the radiator will be set for a given temperature difference.
* **`D` - derivative**: Because `P` is purely based on the difference between the current and target temperatures, it doesn't know anything about inertia.
So, even though your radiator will be getting closer to the target temperature, even when it's very close, P will be saying "more heat, we're not there yet!", and cause you to overshoot your target, having to then go back (possibly turning the AC on, undershooting downwards, and then back upwards, oscillating like that for a long time).
D helps by saying "whoa, we're getting there, slow down with the heat", and reducing the amount of heat you apply proportionally to how fast you're getting to your target temperature.
* **`I` - integral**: `I` helps in the case where you left a window open in the room, and `P` is saying "okay we're pretty close so set the radiator to 10% just for that final push", but the room is leaking so that 10% will never get you to your target temperature.
`I` helps by saying "Okay we've been trying but it's not working, we're still far, so we actually need a bit more heat than 10%", by looking at the constant temperature difference you've been having lately, despite your best efforts.
Basically, `I` deals with accumulated error when you think you're getting closer but all you're doing is fighting losses, so `I` allows you to close that gap.
That's pretty much it!
* * *
<p style="font-size:80%; font-style: italic">
Last updated on January 07, 2021. For any questions/feedback,
email me at <a href="mailto:hi@stavros.io">hi@stavros.io</a>.
</p>

View File

@ -1,6 +1,6 @@
+++
title = "General RC tips"
weight = 0
weight = 2
sort_by = "weight"
insert_anchor_links = "right"
+++
@ -12,29 +12,9 @@ These are general tips for building RC planes/quads/whatever:
To make things a bit easier, I set the back right switch (SG) to override the throttle and set it to the launch throttle (40% for me, for example). That way, I can arm, keep the throttle down, and flip SG with my right hand. That will throttle up enough to easily launch the wing, and if something goes wrong I can still either disarm or flip SG down so the motor stops again.
## PID controller
Basically, a PID loop can be thought of very simply as an equation that takes your current state as input and gives you what you need to do to reach a desired state as output.
For example, if you had a radiator and wanted to heat a room, the PID loop would take the current temperature as input and tell you how high you needed to set the radiator on a 0-100% scale to achieve a desired temperature.
The PID loop has three components, and to tune it you need to set three weights that you multiply each parameter with.
That means that it's basically `output = P*prop, + I*intgr + D*deriv`, where the terms are explained below:
* **`P` - proportional**: This is the weight of the difference between the current position and the desired position.
What this says about the radiator is "we're still far away, we need more heat!", so the more P you set, the higher the radiator will be set for a given temperature difference.
* **`D` - derivative**: Because `P` is purely based on the difference between the current and target temperatures, it doesn't know anything about inertia.
So, even though your radiator will be getting closer to the target temperature, even when it's very close, P will be saying "more heat, we're not there yet!", and cause you to overshoot your target, having to then go back (possibly turning the AC on, undershooting downwards, and then back upwards, oscillating like that for a long time).
D helps by saying "whoa, we're getting there, slow down with the heat", and reducing the amount of heat you apply proportionally to how fast you're getting to your target temperature.
* **`I` - integral**: `I` helps in the case where you left a window open in the room, and `P` is saying "okay we're pretty close so set the radiator to 10% just for that final push", but the room is leaking so that 10% will never get you to your target temperature.
`I` helps by saying "Okay we've been trying but it's not working, we're still far, so we actually need a bit more heat than 10%", by looking at the constant temperature difference you've been having lately, despite your best efforts.
Basically, `I` deals with accumulated error when you think you're getting closer but all you're doing is fighting losses, so `I` allows you to close that gap.
That's pretty much it!
* * *
<p style="font-size:80%; font-style: italic">
Last updated on January 05, 2021. For any questions/feedback,
Last updated on January 07, 2021. For any questions/feedback,
email me at <a href="mailto:hi@stavros.io">hi@stavros.io</a>.
</p>

View File

@ -1,6 +1,6 @@
+++
title = "Getting uninverted SBUS on a no-name FrSky-compatible receiver"
weight = 1
weight = 3
sort_by = "weight"
insert_anchor_links = "right"
+++

View File

@ -1,6 +1,6 @@
+++
title = "Getting uninverted SBUS/SmartPort on the FrSky XSR receiver"
weight = 2
weight = 4
sort_by = "weight"
insert_anchor_links = "right"
+++

View File

@ -1,6 +1,6 @@
+++
title = "INAV tuning tips"
weight = 3
weight = 5
sort_by = "weight"
insert_anchor_links = "right"
+++

View File

@ -1,6 +1,6 @@
+++
title = "Omnibus F4 pro servo diode"
weight = 5
weight = 7
sort_by = "weight"
insert_anchor_links = "right"
+++

View File

@ -1,6 +1,6 @@
+++
title = "Omnibus F4 V3 pinout"
weight = 4
weight = 6
sort_by = "weight"
insert_anchor_links = "right"
+++

View File

@ -1,6 +1,6 @@
+++
title = "Transmitter external module pinout"
weight = 6
weight = 8
sort_by = "weight"
insert_anchor_links = "right"
+++