Making a Robot object – code for our experiments to talk to the robot
Now we have seen how to move and turn our robot, we come on to a layer of software to group up some of the hardware functions and isolate them from behaviors. By behaviors, I mean code to make a robot behave a certain way, for example following a line or avoiding walls. Why would we want that isolation?
When we chose our motor controller, we made many trade-offs to find what works for our project. Motor controllers can change when the considerations change or when we simply want to build our next robot. Although controlling the speed and direction of two motors is the same kind of operation, each controller does it slightly differently. Creating a layer in front of a controller lets us use the same commands for it, even if it changes. This layer acts as a façade or interface to robot functionality.
Each controller has quirks. With this one, we set a run mode and speed. Many controllers use 0 to...