Using the PID Algorithm to Follow Walls
We built a robot with multiple sensors and used distance sensors in Chapter 8, Sensing Distances to Detect Objects with Pico. We can use smarter algorithms with these sensors to make smoother behaviors.
In this chapter, we will investigate the PID algorithm, building its stages into something that will follow objects, then turning that into something that will follow a wall. We will use our new ability to graph over Bluetooth to tune the settings and get a smooth result.
In this chapter, we will cover the following main topics:
- Introducing the PID algorithm
- Using a PID to follow a wall
- PID tuning – using graphs to tune the PID