main-image As a pure CS guy, I’ve competed in a fair share of hackathons and loved every one of them. There’s something comforting about working on a project that’s (usually) solely contained in one medium, computers. Sure, I have to configure servers to do crazy things and sometimes work in low-level languages, but I’m still just writing code at the end of the day. It’s very natural to me and it feels quite safe.

I decided to try something a little outside of my comfort zone. Yesterday was SpaceX’s Engineering Competition at UCLA. I got randomly paired up with three other engineers (aerospace, electrical, and mechanical) earlier this week and were given our team name, Falcon Heavy. All we knew was that we would be working together to compete against four other ensemble teams of UCLA engineers to build some sort of autonomous robot. We weren’t told what materials we would be given until the day before and weren’t told our specific task until the day of. Oh yeah, and we were only given four hours to do it all from start to finish.

This year’s task was to build an autonomous robot that will be dropped from 6 inches in the air into a 5ft diameter arena (photo cred: Alex Ramirez). The robot then needs to needs to navigate itself to the exact center of the arena. We were given Legos, Lego Mindstorm motors, an Arduino, an ultrasonic sensor for Arduino, and tons of wires/resistors/capacitors. The task seemed very difficult given the ridiculously short time constraint, but our team talked over some strategy, and we got to work. Here’s a play-by-play of how it all went down.

12:30 pm - The competition begins. We each get working on our individual tasks. The mechE and aero guys get building the chassis and drivetrain for the robot. The EE works on understanding how to interface between the Arduino and the motor. I work on wiring up the ultrasonic sensor to the Arduino and breadboard and programming it to take in readings.

12:35 pm - The ultrasonic sensor is up and running without any errors. This is pretty much the high point for our team for most of the competition.

1:15 pm - The basic frame of the car is built and the motor works with manual control.

1:30 pm - We can’t figure out how to drive the motor with the Arduino.

2:00 pm - We can’t figure out how to drive the motor with the Arduino.

2:30 pm - We still can’t figure out how to drive the motor with the Arduino.

2:40 pm – Our EE comes up with a hacky way to work the motor and gets building a ridiculously complex circuit.

3:10 pm - Wire stripping and soldering. Lots of it.

3:35 pm - The circuit is ready! We hook it up to the code I wrote to make the wheels move forwards and backwards. No luck. I do some debugging. Still no luck. My code is 100% bug free, so the error must lie elsewhere. We get the multimeter and check the readings on every single pin.

4:00 pm - It turns out there’s some inherent flaw in the circuit design and we’re back to square one. We’re all bummed. There’s less than 30 minutes left and all we have is a car that can’t move. Then all of a sudden, our EE has a stroke of brilliance and gets to work on a completely new circuit.

4:20 pm - The new circuit, this time using an h-bridge, is done and the motor works. Finally! But we only have 10 minutes left. I test out the ultrasonic sensor to check if I’m still getting any readings. No cigar. We had devised an algorithm that would turn the robot 360 degrees and take readings to determine the radius of the arena and the direction in which we had to travel. But without a working sensor, it was all useless. We’re down to 5 minutes left. I scramble to write some sort of code that will get us at least somewhere. We decided to have the car move backwards for 3 seconds. This would back it up into a wall and somewhat align itself (using the wall as a support) to face directly into the center. Then the car moves forwards for 1 second and hopefully that should bring it somewhere near the center.

4:29 pm - I finish writing our sorry excuse for an algorithm and hit upload. Time’s up. We never got in a single test run. Looks like we’re gonna have to do it live.

We survive the drop test. So far so good. The car starts backing up for 3 seconds. It hits the wall and aligns itself. It starts moving forwards. It stops, right in the dead center of the arena. None of us can believe our eyes. Our timings are completely arbitrary but they end up being perfectly spot on. There’s no way we’ll get that lucky during our second run, right? Wrong again Bob. We hit the center target perfectly again.

We narrowly miss the target on our third run, but still perform pretty well compared to the other teams. One of the teams had a really cool robot with a legitimate algorithm, but it wasn’t calibrated correctly so it didn’t do too well.

5:15 pm - The judging is complete. Our team, Falcon Heavy, comes out on top! We get to donate $500 to a charity or student org of our choice, a tour of the SpaceX facilities, and lunch with the co-founder of SpaceX (not Elon Musk, but the other guy).

Lessons Learned:

UCLA engineers are ridiculously good at their respective fields of study.
Working with a group of different kinds of engineers to complete a task is a challenge, but you’d be amazed at how much work can get done so quickly.
Arduinos are awesome and I’ll definitely want to tinker with them some more on my own.
It’s a great exercise to take yourself outside of your comfort zone and place yourself in unfamiliar territory, even at the risk of embarrassing yourself or looking dumb. The learning experience in itself is priceless.