This competition was hosted from 10am, and the competition was held at 8pm. The goal for the competition was to guide various sizes of wooden cubes up a ramp, into a small bin. 2 teams would compete in a match, and after the time is up the blocks are counted to determine the winner. Each team had 8-10 hours to build and program their robot, starting from a collection of parts. We had 4 motors, 4 wheels, motor drivers, and a microcontroller. We had the choice between tank treads, 4 wheel drive, and mechanum. I convinced our team that mecanum would be cooler and more fun, and it almost didn't work out. Mecanum wheels are special wheels with diagonal rollers built-in. These rollers allow the wheels to not only apply force going forward, but also allow the robot to move left and right, using the diagonal rollers to guide the forces. Here are some more details about them:
https://ecam-eurobot.github.io/Tutorials/mechanical/mecanum.html
https://www.instructables.com/How-to-Make-Mecanum-Wheel-Robot-and-Program-It-Cor/
This is our robot! We used whatever we could find to create it, each working on different parts to make sure it all came together in time. I mostly focused on the hardware and firmware (since it was my fault we had mecanum wheels) , while the rest of the team built the shell, tested, designed the pushing mechanism, and thought up a lovely name and theme. for my firmware, I decided that I would try something unique and create a custom program, something the other teams did not do. I will explain that program more in the next section. The mechanum wheels add some dexterity, at the expense of programming complexity. We almost were not able to compete because the program would just not work right. But in the end, we had the most agile bot, and were able to use that advantage to take first place!
For this competition, we were provided with 4 DC motors, 2 L298N motor drivers, each driver able to drive 2 motors. Originally, we were provided an Arduino Uno R4, but I discovered that the library I wanted to use for controlling the robot, was not supported by this controller. The library I wanted to use is called Bluepad32. This library adds extensive bluetooth controller support to ESP32 microcontrollers. This would allow our team to pair a controller directly to the robot, instead of using the provided program, which hosts a wifi server that connects the robot to the computer, allowing the controller connected to the PC to drive the robot. This setup has a lot of latency, which caused most teams many issues. Using the ESP32 controller had its own issues, though. At first, we discovered that the ESP32 we were using had dead pins, which prevented our robot from moving at all. Once we got the programming working, we discovered that as we were controlling the robot, the controls would go dead and the robot would stall. We though maybe the battery was low, or the controller was broken, but after testing everything, I hypothesized that the auxiliary power supply the motor controllers provide was not enough to support the full 750mA that the ESP32 draws when using wireless. To get around this, we connected the 7V battery directly to the power on the ESP32. This isn't usually recommended, but in this case it worked perfectly and fixed our issues immediately.
This was the most difficult part of this competition, but also the most rewarding. I spent most of my time testing this code to get it working, and it was almost our downfall. I began the program with a few example programs, which allowed a mechanum robot to be controlled with a PS4 controller. I realized that this program had no speed control or analog direction control, so it can only move in 8 pre-programmed direction only at full speed. I didn't want this, so I wrote a program that use the kinematic equation for mechanum wheels. For a reason that I didn't have time to find, this solution would not work at all. The directions had to be exact on the joystick, otherwise the robot would not move. It was not going to work for us, so I implemented the fixed 8 directions with my own twist. I manually wrote an analog speed control for each of the directions, allowing our robot to more slowly and precisely, as well as allowing all the directions to be used more easily.