I have not been posting to this blog for a whole month, and what have I been doing all these Saturdays? Robockey. It has been quite a journey and I'd like to take this Saturday to record and share my experience.
What is ROBOCKEY?
Robockey is a autonomous robot hockey tournament held at UPenn each fall, serving as the final project of Mechatronics (MEAM 510). This year was the 6th annual tournament with 24 teams contending. Below is this year's teaser.
The game is quite simple. You are given a rink, a puck, and stars. When given a 'PLAY' command over wireless, you need to find the puck following its IR light, and drive to the opponent's goal locating yourself by looking up at the stars with a mounted camera. The physical requirements is that your robot needs to fit into a 15cm diameter cylinder and be no taller than 13cm.
Anatomy of the Robot
Before the robot can run any code and attempt to be smart, it needs a body and a nervous system. We will discuss those first.
The basic structure is laser cut acrylic connected by standoffs.
We put the sensors (phototransistors) at four corners of our sphere, each corner having 3 sensors shorted together to have a wider coverage. One sensor was added at the mouth of the puck holder and another on the top plate facing down to determine whether we are holding the puck or not. We 3D printed a bottom piece that would hold the IR sensors and cords, while pressure fitting nicely with the bottom plate.
Motors and Wheels
We used Pololu motors and BaneBot wheels.
Batteries and Holder
We used two lithium ion batteries to power the motors, and a 9V battery to power the microcontroller and IR sensors. A battery holder was 3D printed.
From the left: regulator circuit that provides regulated 5V for all other necessary circuits; IR sensor circuit; motor driver circuit; microcontroller circuit.
Everyone used the same microcontroller (M2) that was custom designed for the class. It's quite small.
Putting It All Together
The Brain of the Robot
Within a team of four, my role was programming. Writing software for a microcontroller was quite new for me. Dealing with timers, analog-to-digtial conversion, hardware interrupts, packet-level wireless communication, pulse modulation for variable voltage output, etc. All such functionalities was a struggle to get working in the beginning, but ultimately my job came down to writing control logic. The task of processing the IR sensor and camera inputs to create two output voltages, one for each motor. The solution was to build two PD controllers: one for puck finding and the other for goal finding.
For example, when finding the puck, you can first estimate the theta location of the puck relative to your robot by processing the IR sensor input. Then a simple proportional controller would create a rotational motor voltage proportional to the theta. This would make the robot oscillate in the direction of the puck but never quite get it. If you add a derivative term, effectively dampening the oscillation, you can make the robot rotate to the direction of the puck and stop right there. Now adding a forward speed term to the output motor voltage, that is greater when the theta difference is smaller, you can have a robot the follows the puck quite beautifully. Below is a video of me tuning puck finding, the derivative needs to be higher (you will still notice oscillation), but you will get the picture. The code I wrote for puck finding can be found here.
Driving to the goal is very similar. You just need to use the angle difference between the robot orientation and the direction of the goal as your theta. Of course there is more nitty gritty details such as smoothing a curve when with the puck, or boosting rotational force when stuck on a wall, but in essence, it is the same PD controller. After the PD controllers were built, a lot of the work was manual testing to get the right proportional and derivative constants to use in the controllers. These constants needed to be figured out for each robot, since each of them had different motors and weight.
24 teams competed in the tournament last Thursday. It was double elimination. We won the first two matches, lost, then won, then lost again. We were eliminated right before the semi-finals. A few goals from the tournament.
We put in quite an amount of time into these robots, and the fact that we still did not have a chance at winning says a lot about the caliber of the tournament. I have never seen so many students voluntarily put in endless all-nighters. It was tough competing in a graduate class as an undergrad with less time and experience, but I'm very glad that I did. Could not have imagined to learn more about robotics in a month.
This post would not be complete without mentioning the awesome team that I worked with. Max, who single-handedly modeled and built most of our robots; Ryoo, who designed and soldered all the circuits; Casey, the only person that worked on all mechanical, electrical, and software, pushing everyone forward; and finally, our coach Steve who guided us through critical moments. Thanks all, it was great.