Now we have some basics ready, we can use this to build some more interesting behaviors. The next one will be to chase, but not get to close to, a colored object. This requires a few stages. Let's start with a diagram showing an overview of this whole behavior:
This behavior contains elements you've seen before: the PID controller and the image queue to the browser. The first thing you'll notice is that there are 2 PIDs. One controls the speed of the motors; the other is an offset, which controls their heading.
The speed PID will take a reference size and the size of an object (based on the radius of a circle around it) processed from the camera, it will then provide a base speed to both motors to try and get that radius close to the reference value. That way, the robot...