This behavior will track the line we drew, driving around it and following its curves. Our line-following behavior can be described with a few simple sentences and then we can build it. Let's assume this code starts with the sensor either side of the line; when it crosses into the line, the robot needs to pull to the side to get that sensor back off it. The next diagram shows the behavior visually:
The same behavior can be described as follows:
- The robot starts driving
- When a sensor detects it is on the line, the same wheel will slow down or go backwards, turning the ...