Historically, it seems preparation for a contest really starts the month before the contest and APEC 2011 was no different.
After I attached the sensors in January, I had to calibrate the sensors – I’ll write an article on how I do this. After that I started to investigate which constants I needed to change to use the new wheels that Pierre had made (see post at the end of Dec. 2010 that shows the new wheels). It quickly became obvious that given the time left, I was better off making the mouse work better than spending time on the new wheels.
Even though the mouse has been running and solving mazes for six months, I found a maze configuration where the mouse would drive into the front wall. ZV was designed to never make inplace 90 deg. turns and the problem was that when the mouse stopped, it would stop in the middle of the cell. In this particular maze configuration, the mouse path generator had the mouse stop in the middle of the cell and then the next path wanted the mouse to make a right 90 deg. turn. Since the mouse was in the middle of the cell, it tried to go forward and then turn. If by happen stance when this occurred there wasn’t a front wall, the mouse would make the turn but the mouse location would be wrong.
Another problem had to do with angle alignment that I do during uturns. Whenever the mouse makes a uturn, it looks at the front wall and will rotate the mouse to make sure that the two front sensors’ readings are well matched. In this particular case, the mouse would do the uturn but the alignment routine would make the mouse turn an extra 20 degrees. This problem would come and go.
I had been trying to find and fix these bugs for a couple of evening but with no luck. So, when I left for the contest, I was very concerned that I would not be able to fix the issues in time and the mouse wouldn’t run properly during the contest.
The drive from the house to the airport turned out to be interesting because the car was out of gas. The first gas station I went to at 4AM was closed until 5AM and at that point, I had less than 9 miles of range and had 45 minutes to get to the airport. Fortunately, I was able to find another gas station a few miles away and made it to the airport about 50 minutes before the flight. Since it was an early flight, there weren’t too many people around, so the rest went smoothly.
Once I got to Dallas/Ft. Worth, I waited an hour or so and met up with Peter and we shared a van to the hotel. A little bit after we got to the hotel, we ran into Dave and found out that the maze would be available some time on Sunday morning. Pierre came in later in the evening and Peter, Pierre and I grabbed a bite to eat at a local bar. After we got back from dinner, I thought some more about the “stop in the middle of the cell” problem and was able to find a quick fix.
Sunday morning rolled around and magically, all the mouse contestants showed up at the right spot in the convention center. There was a slight hick-up in that Dave (Otten) forgot the Allen wrench, so to open the maze box, Peter borrowed a wrench from the AV folks. All the contestants pitched in and within twenty minutes, the maze was setup. Usually, when random people setup mazes, you end up with a poor maze design. However, in this case, we lucked out and by accident came up with a really nice maze design.
Everyone started to practice and make adjustments. It was interesting to observe that Kato-san would run his mouse, then think for a bit and then run it again. Due to the language barrier, we couldn’t figure out what tweaks he was making but his mouse was running incredibly well and getting better.
The maze design turned out to be very helpful in that I was consistently able to reproduce the problems I was chasing. While I was quickly able to verify that I had fixed the stop problem, I now saw the intermittent problem with the mouse driving into the front wall. After some investigation, it became clear that this was the same sensor problem I saw in Japan which I had (incorrectly) concluded (at that time) was an interaction between the logging system and the sensors. I had never root caused it so I went through and made sure I turned of logging and everything non-essential but I was still seeing the problem. It was pretty late on Sunday and I was tired, so I decided to call it a night. We all went out and had a nice dinner.
Sometime on Monday morning, I finally figured out the sensor problem: in the uturn alignment routine, I was kicking off a sensor read and this read was interfering with a sensor read that occurred in the millisecond servo interrupt routine. The timing was such that the second read request would occasionally cause the left front sensor to stop working.
Peter continued to make adjustments on his mice. For a while, things didn’t look so good but in the end, he was able to find the right combination of adjustments/changes and his mice were running well.
At this point, ZV was running well and since APEC has a bonus for not touching the mouse, I decided to implement support for APEC rules instead of the Japanese rules strategy that the mouse was currently running. After spending a couple hours on this, it was working well but I found a rather insidious bug. So, after discussing it with Pierre we decide that we would run with the Japanese rules code.
About a month or two before APEC, I decided to setup a source revision control system and that has just been incredibly useful. It made backing out changes trivial. It also let me quickly figure out what had changed. I can’t believe I’ve gone so many years without a source revision control system. There are many choices and all have their plusses and minuses. I’m using Perforce because they have a free offering that works perfectly for me. It also helps that the syntax is the same as the system we use at work.