The code for the Pi-Bug robot has been designed to provide the same interface as the Rover-Pi robot so that they can be interchanged easily. You should notice that each class consists of the same four functions (__init__(), off(), drive(), and cmd()). The __init__() function defines the set of pins we will control, the steptime value of the walking action (this time, the gap between movements), and the previously defined servo module.
Once again, we have an off() function that provides a function that can be called to set the servos in their middle positions (which is very useful for when you need to fit the legs in position, as described previously in the home position). The off() function uses the drive() function ...