Stanley Lio‎ > ‎

ENG1000 Final Competition

The Project
I built a "squarebot" using the VEX kit provided by the school to compete in the competition held at the end of an engineering course. Each team builds a bot that runs on a known track autonomously. The one that travels the most laps in a fixed amount of time wins. Every team gets the same set of used kit *1, so the key to win is only the software - assuming you don't do anything "radical" in the hardware.

The track in 2010

I used a simple differential drive design with two motors, each driving two wheels. Reliable, well-tested, simplest to build.

A VEX "squarebot"

The gist of the challenge is just wall-following. To make things simpler, there's no turn decisions to be made as it's not a maze.

The simplest solution to the wall-following problem is just
  • Curve to the Left when the bot has drifted to the Right side of the track, and
  • Curve to the Right when the bot has drifted to the Left side of the track
The track is narrow, so before making a turn, the bot needs to be at the center of the lane to clear a corner or else it may get caught by the walls. With the primitive algorithm, the bot wobbles along the center of the lane as it travels down the lane and there is no guarantee that it will be at the center of the lane when it reaches the end of a straight section. The system is not stable.

The Champion - showing its ultrasonic sensor mounted on a servo motor

Position, and its Time Derivatives

After staring at it for a few laps, I had this idea that stopped the drunk walk and won the 1st place: in addition to centering the bot on the lane, also align its heading to the direction of the lane. Heading can be inferred from consecutive readings from the distance sensor mounted on the side. For example, if the distance to the left wall is decreasing, it is leaning to the left and thus should adjust its heading to the right before proceeding. With this modification, the bot quickly settles along the center of the lane after every turn - the system is stable and converges quickly.

The effectiveness of that simple modification amazes me even to this day, but I only recognized the solution several years later: it was just a PD-controller. Price paid for not learning enough theory.

Result of the competition

Our team placed first in the final competition. The prof had to change the grading scheme because our bot vastly outperforms even the runner-up.

The Lesson

The difference in engineering programs matters a lot. When I was doing the course, emphasis was placed on project management and design methodologies (draw CAD before building, making project timeline and budget, leave no time for iterative development). Management might be important for real-world projects, but I am more interested in the technical side of things - control theory, embedded systems, programming. The experience would have been much more meaningful had we studied LTI system theory before the course.

*1: passed down from previous generations of students with loose connectors, bent wheel shafts, worn out rechargeable batteries and mismatched motors - typical of any shared resource in schools.