Add quadrature encoder starter course
This commit is contained in:
commit
032ef0a15b
5 changed files with 140 additions and 0 deletions
|
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
title: Measuring Wheel Speed
|
||||
summary: Convert encoder counts over time into rotational speed for a drive wheel.
|
||||
chapter: Using Encoder Feedback
|
||||
order: 1
|
||||
tags:
|
||||
- speed
|
||||
- odometry
|
||||
- robotics
|
||||
estimated_minutes: 9
|
||||
---
|
||||
|
||||
# Measuring Wheel Speed
|
||||
|
||||
Position counts become useful control signals once you add time.
|
||||
|
||||
To estimate wheel speed:
|
||||
|
||||
1. sample the encoder count at a fixed interval
|
||||
2. subtract the previous count from the current count
|
||||
3. divide by the sample period
|
||||
4. convert counts per second into revolutions per second or wheel surface speed
|
||||
|
||||
## Why this matters
|
||||
|
||||
Speed feedback is the bridge between open-loop motor commands and predictable robot motion.
|
||||
|
||||
If two drive motors get the same PWM value but spin at different speeds, your robot will drift. Encoder-based speed estimation lets you detect and correct that mismatch.
|
||||
|
||||
## Checkpoint
|
||||
|
||||
Plot wheel speed over time while ramping the motor command up and down.
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: Closing the Loop with a PID
|
||||
summary: Use encoder speed feedback to hold a target wheel speed with a simple controller.
|
||||
chapter: Using Encoder Feedback
|
||||
order: 2
|
||||
tags:
|
||||
- control
|
||||
- pid
|
||||
- robotics
|
||||
estimated_minutes: 12
|
||||
---
|
||||
|
||||
# Closing the Loop with a PID
|
||||
|
||||
With encoder speed feedback in place, you can command a target speed and adjust motor output based on error.
|
||||
|
||||
The basic control loop is:
|
||||
|
||||
- measure current speed
|
||||
- compute `error = target - measured`
|
||||
- update the controller
|
||||
- send the new motor command
|
||||
|
||||
Start simple. A proportional controller is often enough to prove the loop works before adding integral or derivative terms.
|
||||
|
||||
## What good behavior looks like
|
||||
|
||||
- the wheel reaches the target speed quickly
|
||||
- overshoot stays limited
|
||||
- the response remains stable when load changes
|
||||
|
||||
## Checkpoint
|
||||
|
||||
Tune a controller so the wheel returns to the target speed after you briefly drag on the tire by hand.
|
||||
Loading…
Add table
Add a link
Reference in a new issue