Lesson 23: Recap
This recap covers the second group of lessons: debugging, state, timing, encoders, gyros, pneumatics, threading, and PID control.
You Should Be Able To
- Describe a robot bug clearly before changing code.
- Use print statements or dashboard values to inspect important variables.
- Create state variables for a mechanism.
- Use calibration constants instead of magic numbers.
- Use timers without blocking the robot loop.
- Read an encoder and convert counts into distance.
- Read a gyro angle and use it as feedback.
- Command single and double solenoids.
- Explain why extra threads should be used carefully.
- Calculate PID error and write a simple proportional controller.
Practice Project
Design a small elevator in code. You do not need real hardware for the design. Write the classes and variables you would use.
- Create states for idle, moving up, moving down, and holding.
- Add calibration values for motor speeds and maximum safe height.
- Add an encoder value for position.
- Add a timeout for movement.
- Add a proportional controller that moves toward a target height.
If you can explain how those pieces fit together, you are ready to apply feedback control to drive trains.