In a few days, I will be on a plane to Taiwan for the 2011 Taiwan contest. After the disaster that was the UK summer contest, I have been working hard on Decimus 2 in the hope of having a decent mouse for the contest…
Decimus 2 is a major re-write of the older Decimus code. There were many areas of concern. Mostly, I had problems with being able to have the mouse run an arbitrary distance or turn through an arbitrary angle. All the moves were multiples of a single cell or of 945 degrees. That was making it very difficult to do things like adjust for an error when facing a wall.
Also, the profiler code was very poor with an unreliable inner control loop. Errors were high and there was not good feedforward compensation. The feedback control bandwidth was not good and any attempt to move at accelerations beyond about 3500mm/s/s were uncontrollable.
All feedback came from the wheel encoders and any kind of slippage during a turn could prove fata with no easy way to correct for the error after the turn finished.
Decimus had never run with a gyro and that seemed a good candidate for major improvement. Pretty well all the top mice rely upon the gyro to help control straight line steering and the turns. Without one, there is an upper limit to the performance available.
Diagnostic work was difficult since there is limited RAM for recording data while the mouse was running and the serial interface had an annoying tendency to reset the processor when connected to the PC.
All in all it does not sound good.
On the plus side, the solver and command processor seem to be fairly robust for the time being.
Almost all of the low level code needed re-writing and almost none of the existing code was worth keeping. Work properly started at the end of April after Minos. I have been using the git revision control software to keep tabs on the changes. This is a very nice tool that allows me to have a local repository which is a mirror of reference copies I keep on two different on-line free git hosting platforms – unfuddle and beanstalk. Looking back at the logs, I can see that I have made 297 commits to the system since April 24th.
Work stopped in June for the UK contest. Although Decimus 2 made it around the maze, the performance was poor and it crashed out in the final. Not good.
After a long break through July and August, work started again on September 2nd. Since then 66 changes have been recorded in the database and Decimus 2 has returned to the state where it can search and solve the maze and at least make an attempt at a speed run.
There are some definite improvements…
The motor controller has much better open loop performance. The mouse can make many moves with acceptable accuracy even when the controller is turned off. This is achieved through feedforward components that compensate for the mouse speed and acceleration as well as the small amount of friction in the drive train. The result is that, even with the feedback from the wheel encoders turned off, Decimus 2 can do a 180mm move with 3000m/s/s acceleration with a maximum error at any point during the move of less than 3mm. Previously, I would be lucky to get within 10mm of the target and the result would be different depending on whether the move was forwards or backwards.
Maximum acceleration has been increased. Up to 6000mm/s/s is possible before things start to get difficult. As much as 7000mm/s/s is possible under ideal conditions with a good surface and freshly cleaned tyres. I realise this is some way short of that demonstrated by the top mice but it is a substantial improvement for Decimus 2.
A gyro has been added to control turns. The original plan was to use the gyro for turns when the mouse is moving and the encoders when it is stationary. So far, I have not added the changeover and the gyro is responsible for all turns. It took a while to get the calibration and other factors sorted out but now turns are remarkably repeatable and I can have a high degree of confidence that the mouse will turn through the angle requested even in the face of some wheel slip. That still causes some trouble because the controller is a bit over assertive. After a knock that causes the tyres to lose grip, the mouse will oscillate quite wildly and may not be able to settle down. There should be a simple enough fix for that – possibly by limiting the controller output change. I shall have to add it to the todo list.
Gyro drift is a strange issue. With the mouse stationary on the bench, the gyro shows a drift of less than 1 degree in 5 minutes. However, if I have the mouse drive around in wall following mode and transmit the angle as measured by the gyro, it very quickly deviates from the actual angle of the mouse. It is not clear if this is because of noise when the mouse is running or some other error in the calculations. Nor is it clear how to find that out. For now, it means that I cannot use the gyro for general steering, only the control of actual turns. In spite of that, I think the gyro is largely responsible for the mouse’s ability to accelerate harder in a straight line. Previously, high accelerations would have the mouse shoot off to one side. Now, I think the gyro detects that and compensates by slowing down the slipping wheel. It is not clear that is actually the case, it could just be due to the improved controller. Something else for the todo list – record some data for high accelerations and see what happens when the mouse loses control.
Adding a bluetooth serial module has been a huge help. The Nokia LCD I used before has now been completely dispensed with and, in its place, I can fit a carrier board with an RN-42 bluetooth serial adaptor. This connects to my PC as if it were a serial lead and can talk reliably at 115200 baud. I have not tried it faster – that was just the speed it was already configured to. This is big, heavy and high up so it will have been upsetting the dynamics of the mouse but I figure the mouse will just behave better without it. Since it just plugs in and the serial interface is asynchronous, I can just remove it and the mouse works the same as it did with the board on. The serial diagnostics messages are still printed – they just go nowhere. With the module, it is trivial to transmit continual readouts from the sensors, the gyro, the encoder or the profiler working parameters and see how they relate to the physical behaviour of the mouse. I should have done this a long time ago. There are smaller and lighter modules but this is what I had to hand. the next enhancement will be the addition of some interactivity so that I can make specific requests – even while the mouse it moving. For entertainment value, it might be interesting to have a live telemetry display showing the maze map and the current mouse posture and speed … one day maybe.
With so many changes, I should probably re-name it Decimus 3. If I had had spare hardware available, I would certainly have built a new chassi and these changes would have gone into that.
So far then the mouse does its job. There are still plenty of things to fix. Notably, it has a distressing tendency to miss edges and overshoot turns at speed. I hope to have that fixed quickly because there are plenty of other things that need to be sorted out before having to get on that plane. It would be best not to have to do them after arriving.