Finally, an opportunity to practice for the contest…

Around 4:30AM, I finally got out of bed and started coding. About an hour in, I went to plug the laptop power supply into the wall and realized that the laptop had a three prong plug but the wall socket was only two prongs! I sent Peter a note and he responded within an hour. So around 6AM I borrowed an adapter from him and continued coding. By breakfast time, I had the front wall based longitudinal correction partially coded. After breakfast, we walked to the location of the contest, the Capio, and I was hoping to get some practice in so that I could verify all the things I had been coding. But it turns out that the location was still being setup and wouldn’t open until the afternoon. Given how much coding was still left, I was thinking about giving up but Dave and Peter encouraged me to continue coding. So, I went back to the hotel and Dave and Peter went to the Real World Challenge. After a few more hours of coding, I finished the front wall based longitudinal correction.
Around 2:30PM, I went over to the Capio and met up with Peter and Dave. We went into the huge hall and were immediately excited by all the activity around us. We scouted out a table to setup but I found that it was a little distance from the practice mazes and so I moved to a closer table. I programmed the mouse with the latest code and tried it on the maze and the mouse made it through a portion of the maze and promptly drove into a wall. I then went into a furious cycle of backing out changes and didn’t have much luck in isolating the problem.
For debugging, I use a serial link and do “printf” of different variables. In the early days, one could hook up a cable and let the mouse drag it behind it. However, as mice have become smaller, lighter and faster, this is no longer feasible. So, I’ve started using a Bluetooth to serial adapter. I made a small board on to which I soldered a Roving Networks RN-41 and plug that into the serial port on the mouse. Using this setup, I was able to take my laptop and mouse over to the maze and get debug info. while the mouse is running in the maze. Since there were twenty people trying to practice on the same maze, I became concerned that I was going to drop the mouse or the HDD on the laptop would become unhappy from being moved around. So, I started to leave the laptop back on the table while I was at the maze. On one of the first few runs, I had not commented out the printf code and when I got back to the table, I noticed that I had serial output from the mouse from over 25 feet (10m) away! I had thought that the many WiFi networks would have swamped out the BlueTooth link and so this was a very pleasant surprise. Later, I discovered that I had over fifty feet (20+m) of range. So, from then on, I kept sending data from the mouse to the laptop while it sat safely on the bench. It was amazing to look around as many people were trying to make things work and/or optimize settings. The energy is just electric.
The Capio closes at 6PM and just before it closed, the debug effort eventually showed that after a certain point, the front and side wall sensor data was zero. I had written the sensor code about six or eight months ago and so wasn’t excited about trying to debug it. The sensor code is complex – basically, it uses timers and DMA to pulse the emitters and then sample the detectors and finally the A/D data is DMAed to memory. The downside was that it took some time to write and debug and since it uses HW, the CPU overhead is pretty close to zero. While walking back from the Capio to the hotel, I mentioned this piece of info. to Peter and Dave and we started to brainstorm how to debug it. Peter came up with the idea that since cameras are sensitive to IR, perhaps his iPhone could be used to detect if the emitters are firing or not. Then I would be able to check either the emitter or detector code. We tested the iPhone and sure enough you can see IR emissions with it. I used it and determined that issue was not the emitter. After more debugging, I narrowed it down to an interaction between the sensor code and the data logging system – ZV has a 4MB serial flash and the idea is that I will write all “interesting” info. to the flash so after a contest, I can dump all the info. and figure out what really happened. Because of the interaction and not having time to debug it, I quickly gave up on the idea of logging. With this fix, the mouse was running again. I finally went to sleep around 1AM on Saturday.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.