Line following with the PID algorithm
In this section, we will combine the visual processing seen previously with the PID control loops and camera streaming seen in Chapter 13, Robot Vision – Using a Pi Camera and OpenCV. Please start from the code in that chapter.
The files you will need are as follows:
pid_controller.py
robot.py
servos.py
camera_stream.py
image_app_core.py
leds_led_shim.py
encoder_counter.py
- The templates folder
We will use the same template for displaying this, but we are going to add a quick and cheeky way of rendering the diff
graphs in OpenCV onto our output frame. Matplotlib would be too slow for this.
Creating the behavior flow diagram
Before we build a new behavior, creating a data flow diagram will help us get a picture of what happens to the data after we've processed it.
The system will look familiar, as it is very similar to those we made in Chapter 13, Robot Vision – Using a Pi...