You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fbad473
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/advanced-stuff/how-pid-work.mdx
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,9 +11,9 @@ import PIDDroneAnimation from '@site/src/components/PIDDroneAnimation';
11
11
12
12
A **PID controller** repeatedly adjusts a mechanism until it reaches a target. On a robot, that target might be an elevator height, an arm angle, a turning angle, or a wheel speed.
13
13
14
-
We are going to use a drone as an example for expalaining PID:
14
+
We will use a drone to explain PID:
15
15
16
-
**imagine that a drone starts at `0` metres and must hover at `50` metres.**
16
+
**Imagine that a drone starts at `0` metres and must hover at `50` metres.**
17
17
18
18
The controller repeats this process many times per second:
19
19
@@ -30,9 +30,9 @@ error = setpoint - measurement
30
30
31
31
The simulator graphs the drone's **height**, not its error. The dashed line is the setpoint at `50`, and the coloured line is the simulated response. Every graph is interactive, so move the sliders and observe what changes.
32
32
33
-
## P: make the drone move toward the target
33
+
## P: Moving the Drone Toward the Target
34
34
35
-
Right now, the drone is sitting at `0` metres. We want it at `50` metres, but nothing is telling the motors of the propellers to spin.
35
+
Right now, the drone is sitting at `0` metres. We want it at `50` metres, but nothing is telling the propeller motors to spin.
36
36
37
37
Let's start with a simple idea:
38
38
@@ -56,12 +56,12 @@ The drone gets a big push when it is far away and a smaller push as it gets clos
56
56
57
57
<PIDDroneAnimationp={0.35}i={0}d={0} />
58
58
59
-
It looks like P should be enough—but if you read the graph (animation) carefully, you might find that there is a problem.
59
+
It looks like P should be enough—but if you watch the graph and animation carefully, you might find a problem.
60
60
61
-
The drone has to **fight gravity** (and mabye air resistance). As it gets closer to `50`, P gives it less and less power. Eventually, the motor output may become just strong enough to fight gravity, but not strong enough to climb any higher. The drone gets stuck below the target.
61
+
The drone has to **fight gravity** (and maybe air resistance). As it gets closer to `50`, P gives it less and less power. Eventually, the motor output may become just strong enough to fight gravity, but not strong enough to climb any higher. The drone gets stuck below the target.
62
62
63
63
This error is called **steady-state error**. P made the drone go up, but we need something to eliminate the constant error.
64
-
## I: fix the leftover error
64
+
## I: Eliminating the Remaining Error
65
65
66
66
Imagine the drone has been stuck at `47` metres for several seconds. The error is only `3` metres, so P is not giving it much help.
67
67
@@ -90,7 +90,7 @@ While the drone was climbing, I kept storing error and adding power. That stored
90
90
91
91
Now we need a way to slow the drone down before it shoots past `50`.
92
92
93
-
## D: slow down before overshooting
93
+
## D: Reducing Overshoot
94
94
95
95
Imagine riding in a fast car. Even if the driver stops pressing the gas at the finish line, the car will not stop instantly because of inertia, so the driver must brake **before** reaching the line.
96
96
@@ -117,7 +117,7 @@ D helps with overshoot, but it cannot fix a drone that stays below the target. T
117
117
A real sensor is never perfectly smooth. Because D reacts to quick changes, too much D can also make a real motor shake or jitter.
118
118
:::
119
119
120
-
## Put the three terms together
120
+
## Combining the Three Terms
121
121
122
122
A PID controller adds all three results:
123
123
@@ -131,7 +131,7 @@ output = Kp * error
131
131
-**I** remembers error that has persisted.
132
132
-**D** responds to how quickly the mechanism is approaching or leaving the target.
Copy file name to clipboardExpand all lines: docs/advanced-stuff/limelight.mdx
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
sidebar_position: 1
3
3
title: Limelight
4
-
description: Info & tips on how to use limelight and implement vision subsystem
4
+
description: Learn how Limelight vision supports robot pose estimation.
5
5
---
6
6
A Limelight is a camera with a small computer inside it. Instead of sending every camera image to the roboRIO, the Limelight processes the images itself and sends useful results to the robot.
7
7
@@ -39,13 +39,13 @@ The drivetrain can estimate its position using wheel encoders and a gyro. This i
39
39
Odometry is like walking with your eyes closed while counting your steps. It works well at first, but every small mistake gets added to the next one. Wheels can slip, the robot can be pushed, and sensors are never perfect. After enough driving, the estimated position slowly moves away from the robot's real position. This is called **drift**.
40
40
41
41
<details>
42
-
<summary>If you wonder how odometry actually works and why error(caused by drift) accumulates over time, check this video 👇🏻</ summary>
42
+
<summary>Watch how odometry drift accumulates over time</summary>
43
43
44
-
<iframewidth="560"height="315"src="https://www.youtube.com/embed/GEZBYHVHmFQ?si=XPT36MprT-TR4ues"title="YouTube video player"frameborder="0"allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"referrerpolicy="strict-origin-when-cross-origin"allowfullscreen></iframe>
Therefore, the position might be wrong if our robot only ues gyro to precoess pose estimation.
48
+
Therefore, the estimated position can become inaccurate if the robot relies only on wheel encoders and a gyro for pose estimation.
49
49
The Limelight gives the robot another way to check its position. When it sees a known AprilTag, it can create a relatively accurate vision pose. So, a WPILib pose estimator combines both sources:
50
50
51
51
- odometry gives fast and smooth updates;
@@ -109,10 +109,10 @@ if (visionEstimate.tagCount > 0) {
109
109
This is the main job of a vision subsystem: get the newest camera result, reject results that are obviously unusable, and pass good measurements to the drivetrain's pose estimator.
110
110
111
111
:::warning
112
-
Do not trust every camera result automatically. Reject a result if no tags **(or less than two tags, if you want an accurate result)** were seen, and consider rejecting it while the robot is spinning extremely quickly.
112
+
Do not trust every camera result automatically. Reject a result if no tags **(or fewer than two tags, if you want a more accurate result)** were seen, and consider rejecting it while the robot is spinning extremely quickly.
113
113
:::
114
114
115
-
Read the [MegaTag2 guide](https://docs.limelightvision.io/docs/docs-limelight/pipeline-apriltag/apriltag-robot-localization-megatag2)and [Limelight APIs](https://docs.limelightvision.io/docs/docs-limelight/apis/limelight-lib) before preogramming a limelight.
115
+
Read the [MegaTag2 guide](https://docs.limelightvision.io/docs/docs-limelight/pipeline-apriltag/apriltag-robot-localization-megatag2) and [Limelight APIs](https://docs.limelightvision.io/docs/docs-limelight/apis/limelight-lib) before programming a Limelight.
0 commit comments