IEEE MicroMouse 2016 + Software Design
Welcome! The figure above shows Falcon — Our autonomous maze-solving robot from Team Falcon, UC San Diego. We are a group of Electrical and Computer Engineering student who developed this robot from scratch over the course of a year, and we participated in the UCLA All American MicroMouse Competition (AAMC) and UCSD California MicroMouse Competition (CAMM). We are very proud to work together as a team to achieve this large feat this year!
Here is our team picture at the UCSD CAMM competition :)
For the software team, we developed the software code for the control logic of the mouse and the embedded code for the hardware components. We used a STM32F401 board and the Mbed IDE for all the programming tasks. For the first half of the development process, we focused on constructing the code for the hardwares parts (gyro, IR sensors, motors, etc), testing the correctness of the algorithms, and integrating all the code together to build this software system.
For the maze-solving algorithm, we used a modified version of the origin Flood-fill algorithm to improve the effectiveness of the mouse. Below is an image showing the logic of the algorithm.
The maze is pre-stored in a matrix data structure and the each cell of the matrix contains a distance field that shows the distance between this cell to the center. During the first run of the mouse, each time when the mouse advances to the next cell, it would update the distance until the fastest route is found. At first, since we did not have the hardware, we simulated the algorithm virtually and it worked out well.
On the other hand, we developed the embedded software code for the hardware components. We constructed separate classes for each hardware and ran preliminary tests with signals to check the correctness of the code. The main software challenge of the mouse comes after all the hardware parts are assembled. Here is a image of our prototype mouse.
As you can see here, the mouse is somewhat straying away from the wall. This is because of the PID control logic. The PID is supposed to keep the mouse navigating on a straight line and any deviance from the desired value would cause the mouse to behave weirdly. Since we have not yet found an efficient way to get input back from the mouse, we did started small with very simple wall cases to incrementally debug the mouse.
And a teammate compiled some musical code onto the mouse as well…
Also, we had some issues with the mouse turning. To solve this, we simply coded a wall follower algorithm on the mouse and make it run in a small maze so we can test out its turns. As we were testing the mouse, the gyroscope somehow was corrupted so we had to go without it. It posed a significant challenge because the precision of turning went down a lot without using the gyroscope to make an exact ninety degrees turn. We could only rely on encoders and certain turning algorithms that is derived based on the wheel distance and the mouse width. As expected, the mouse did not turn in the same way we want. We improved the performance caused by this issue by adjusting the speed and the sensitivity of the PID code to make sure the mouse does not coast while its turning, and we were able to get it to turn close enough to navigate simple maze routes.
We couldn’t make the mouse to navigate in the way we wanted before the competition day because of the PID control. It seems like that the PID is too sensitive for some edge cases of wall placements. Since we were running out of time to rewrite the PID code from scratch, we modified the mouse’s speed based on adjusting the original sensor input and it improved the situation. However, as a trade-off, the PID becomes way too less sensitive that the mouse misinterprets some cases of the walls and it crashes right into them. As a result, we could not used the original flood-fill algorithm on the mouse because it crashes into the wall all the time and will disrupt the previously stored distance values in each cell.
As a result, we used a modified heuristics algorithm for the mouse for the race day. As expected, the mouse crashes into the wall for a few times, but it generally traverses the maze with ease and its performance is what we expected. We came to be very close to finish the exploring the maze (only too cells away!!). As a result, we did not finish solving the maze but we won the most tiles traversed award. Since all of us are first timers to the MicroMouse competition, we are very proud of our original work and each other’s work and dedication.
See our mouse in action for this year’s competition :)