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, but isolate them from behavior. Why would we want that? When we chose our motor controller, we made a lot of trade-offs to arrive at one that works for our project. Motor controllers are one of the parts of a robot that can change, because the considerations change or we simply want to build our next robot. Although broadly having two motors and controlling the speed and direction is the same kind of operation, each controller does it slightly differently, so creating a layer in front of it makes a facade—we get to use the same commands to it, even if it changes.
Each controller has a quirks. With this one, we set a run mode and speed. Many controllers use zero to mean stop...