Now that Decimus has all its bits fitted, it is time to get on with the more serious business of driving it about. The basic code for the motor PWM driver has been tested and suitable drive commands can be sent to them. Since this is a PWM system, a motor command is effectively a percentage of the battery voltage applied to the motor. The encoders produce about 26 pulses per millimeter. This has yet to be calibrated. A very simple speed control has been implemented for the first test.
In the main control loop, which runs every millisecond, the encoder count is subtracted from the previous count. The difference is the speed of the mouse. In this test, the controller simply decides whether or to to apply power. If the encoder count is more than one, power is turned off. If the count is less than one, power is turned on. This is a bang-bang system and is remarkably good at maintaining a constant speed. Full power is not used, just a value large enough to comfortably exceed the i count-per-tick set speed. It readily copes with small variations in the slope of the maze. Even when the wheels start to slip, they maintain a constant speed.
Setting the speed of one wheel to two counts per tick while the other is at one count send the mouse round in a circle. The diameter of this circle is determined only by the relative speeds of the wheels and the distance between the wheels.
Here is a shaky bit of video of Decimus on the move – I have no idea what the odd noises are. They don’t come from Decimus.
Share this post : |