It has been a couple of weeks since returning from Taiwan. I would have written about it sooner but things did not go quite to plan robot-wise and I wanted to find out exactly what happened.
This year, I have finally started to run a mouse with a suction fan. This is Decimus 5 (D5). Nothing terribly special or even very original by the current standards. There are many mice like it but this one is mine. In the preparation for the contest I spent a lot of time getting it set up. Not enough time – but quite a lot all the same. Mostly, I wanted to find out what kind of difference a suction fan makes to performance. The short answer is – LOTS.
Fan assisted performance.
With the fan, its motor and larger batteries to energise it, the all-up weight of the mouse is 104g. On top of that the fan is currently set to provide an additional downforce of about 150g. All that extra downforce significantly increases the grip over its predecessor. For example, forward acceleration is now set to 25m/s/s compared to 14m/s/s on D4 and that is without any of the unstable nose-lifting demonstrated by D4. Turns are much faster. On a good day and ideal conditions, D4 could run turns with centripetal acceleration of 24m/s/s. That equates to running the SS90 turn at about 1450mm/s. With the fan running on D5, that is now the starting figure for speed runs – that is, the first fast speed. So far, with the current settings, D5 can run the SS90 turn at a little over 2200mm/s.
It should be possible to improve on these figures because I have not yet set the controller constants up for this mouse. It is running with all the same parameters as D4. There is also a possible problem with the front-to-back balance of the mouse since there are signs that it oversteers and fishtails out of faster turns.
The fan also seems to change the behaviour of some turns. Drift is generally less and some turns seem to need no compensation at any speed. There is plenty of scope for proper setup and tuning and i see no fundamental reason why it should not perform as well as any other mouse out there, with the possible exception of Khiew Tzong-Yong’s Excel 9. Not to worry though. Revisions are under way.
Mostly, the software in the mouse was ported straight from D4. The idea was that new code had been developed on D4 as it was a proven platform and the transfer to the new mouse would be relatively easy. Guess how that turned out. I had been confident that all I had to do on practice day would be calibrating the sensors and fine-tuning the turns for the (always) excellent Taiwan maze.
Within a few minutes, it was clear things would not be that easy. To cut a long as frustrating story short, D5 would not explore reliably, It ran into walls, made wrong turns, missed the goal and generally behaved very badly. Poor searching was the last thing I expected and has not been a problem for me for quite a few years. After several ours of wrong guesses and poor analysis on my part I determined that the problem was in the mouse not reliably registering walls in front. The symptoms appeared to be exactly the opposite and for several hours, I had been convinced that it was adding walls that were not there. Testing was hugely complicated by the fact that the practice maze was fixed and so it was not possible to set up small test areas in the usual way. By the time I found, and corrected the problem, there was only about 40 minutes of practice time left but D5 was able to search successfully and ran the test maze better than I had hoped. There had been no chance to improve any of the turns or do any of the other fine tuning I wanted but it was working and it was quick. The contest still had promise and at least I would not look too stupid the next day.
Contest day is always busy. There is essentially nothing you can do with or for the mouse so you get to relax and watch the other events until it is your turn to run. The day starts with a short opening ceremony with the international invitees gather on the stage. This is a great bunch of people that I have got to know at these events. There is always something to share and learn and everyone is extremely friendly and helpful.
The main hall is packed with robot contests. Too many to really describe here but new this year was a sumo tournament.
There was plenty to see but it was soon time for my event and I was keen to see what D5 could do.
The contest maze was interesting. It was pretty clear that the magenta path was the fastest but it was the same length as the cyan path. Not all mice found the optimal route and there were a couple of alternatives that differed in detail depending on the search algorithm and the thoroughness of the optimiser.
The initial search by D5 was, I thought, a really good run. It seemed not to make any mistakes and ran beautifully. In fact, it turned out to be the second fastest search run. After a quick clean of the tyres, I placed D5 back in the maze for the first speed run. When started, however, it proceeded to to do a search run again. I knew it had a solution since the indicator light had come on and it would not return to the start without a solution. It was another beautiful search. This time with full knowledge of the maze, it made no wrong turns and ‘searched’ straight to the goal and back without error. No problem, I thought, maybe there was some lingering missing cell in its tiny brain that needed checking out. No chance any more of a good score but at least I might get a couple of decent runs in to prove it worked.
Nope. And then nope again. I retired with no speed runs. Unbelievably disappointing. The only consolation was that the three direct search runs were remarkably consistent with times that were within 15ms over 18seconds – better than 0.1%. That’s something – right?
Follow up from failure
I am afraid that, after that, I was no longer paying huge attention to the rest of the event and did not even get to see the line follower finals. Instead, I spend my time trying to work out what had gone wrong and how to fix it. I even went off, retrieved my computer and re-programmed the mouse so that, after the contest but before the packed everything up, I could try it again.
The basic bug was not too hard to find. The mouse found a solution and headed back to the start ready for a speed run. On the way back, it is still, technically, searching and so can find new information in case there is an improvement. In this maze, it did. the bug had probably been there for a long time but it took this contest maze to reveal it. Because the maze had changed after a solution had been found, that solution was no longer valid and the mouse felt compelled to set out on another search. The real problem was that the code that decided there was a solution, and the code that told the mouse to carry on searching was not the same and they disagreed about the status of the maze. As I say, easy to fix and it would never have shown up on the simple test mazes I can make at home. Nor, apparently had it shown up in any other contest mazes. Lesson learned.
Now I ran again after the contest, in the same maze. The search was good, the mouse returned, had its tyres cleaned and was loosed for a speedrun. It was quick, very quick, everything I could have hoped for. Until it got about halfway round, stopped and then ran off into a wall. It did this quite reliably and repeated itself twice more before I gave up and accepted that I really was not contest-ready after all.
This second bug may be new or it may not. I cannot be sure but it, too was revealed by this maze and not by others – including the practice maze of the day before. The problem here was that, after getting a solution for the maze, the pathfinder determines the best route and passes it to the code that performs a speed run. A requirement is that the path should not pass through unexplored cells. Seems reasonable. However, the mouse can actually determine the existence of walls without having to visiting a cell. In this maze, the optimal path ran through a cell where it was perfectly safe because the important walls had been mapped but, because the cell had not been visited, the mouse stopped at that cell and reverted to searching again. Since it was never intended to switch from a high-speed run to searching within one cell, it crashed. So – even if I had not suffered the search error, I would still not have managed a speed run because of this error. It did not take too long to work out what had gone wrong but I have spent the last couple of weeks working to make sure there are no other bugs in this basic mouse logic.
For many years, I have known that I need a mouse simulator so that I can run a virtual mouse in virtual mazes and test search and path generation algorithms. It is not really enough to run in small mazes at home where it is difficult to set up mazes complicated enough to really test the algorithms. Worse, there are definitely mazes that can cause trouble for some algorithms. I know, for example, that my code can thrash during the search. That is, it can go back and forth between two cells in an endless loop. To combat this, the code counts the number of reversals and quits if there are too many. It is rare for this to be triggered and it never happens on simple mazes. Thus far, this has never meant that I do not have a solution or that I cannot perform a speed run. Even so, it is a sign of a problem that should have been fixed a long time ago.
The Taiwan contest finally spurred me on to get this job done so now I have a simulator and it has allowed me to improve the search and path generation. Searches, including optimisation, should now be significantly quicker, path generation is more reliable and there are no issues with any of my large set of past mazes.
Not that there are any guarantees that there are not still pathological mazes out there waiting to cause trouble.
For the classic micromouse, the results were:
|ID||Team Name||Best score||Rank||Best Run|
For more results – particularly for the other contests see:
Classic Micromouse Video
Excel 9 – Khiew, Tzong-Yong – first place:
Hippo C – Liao, Huan-Jie – second place
Red Comet – Utsunomiya Masakazu – Third place