Robocon 2024 - War Dragon R2
Jan - June 2024
Role: WD R2 Embedded SW
Technologies: STM32, RTOS, Trajectory Planning, Inverse Kinematics, C, Embedded Systems
🏆 About ABU Robocon 2024
📄 Official Theme & RulesThe theme for ABU Robocon 2024 was "Harvest Day". Two teams (red and blue) compete in a 3-minute match. Each team operates two robots: a manual/semi-automatic Robot 1 (R1) and a fully-automatic Robot 2 (R2).
The R2 robot (our focus) operates in Area 3 and the storage zone. Its main tasks are to collect balls (paddy rice / empty grain) from the storage zone and deposit them into silos to score points. The robot must navigate dynamic obstacles, detect ball colours, and decide which silo to target.
Below is the official theme video explaining the rules in detail:
Overview
For War Dragon R2, I contributed embedded software development, focusing on robust pathing and integration of new features. I also worked on the robotic arm library R&D during the early season.
Robotic Arm Library - Prototype & R&D
From September to November 2023, we explored using a robotic arm for R2. I developed a reusable library supporting various arm configurations:
- 2-axis robotic arm
- 3-axis robotic arm
- 3-axis with yaw
- 3-axis with yaw and wheelbase
Library features:
- Basic control: Move each joint to a specific angle.
- Local coordinates control: Pass 2D/3D coordinates relative to the arm's base; inverse kinematics calculates joint angles.
- Global coordinates control: Same but relative to the game field.
- Percentage pathing: All motors move in sync - the slowest motor determines overall speed, others move proportionally to finish together.
- Bézier pathing: Adapted Trajplanner for robotic arms. The output XYTheta coordinates are fed to the local coordinate controller.
Challenges
- Discontinuity in math: Multiple inverse kinematics solutions required careful selection; if-case logic caused sudden jumps.
- Inaccurate angles: Backlash in motors, gears, and belts led to positioning errors. Gravity caused the arm to droop, making it difficult to reach extreme positions accurately.
While the robotic arm concept showed promise, it was ultimately not used in competition. However, the library provided valuable experience and may be useful for future loading mechanisms.
R2 Pathing & Software
For the competition robot, pathing was divided into two categories:
Static Paths
From Start Zone to Area 3, we used a fixed Bézier curve with trapezoidal velocity profile. The start velocity was set to 4 m/s to jump-start and reach maximum speed quickly.
Dynamic Paths for Area 3
Paths from Area 3 to the storage zone and from the storage zone to optimal silos were computed dynamically based on conditions and strategy. The area is full of obstacles (other robots, balls), so paths are formed by combinations of straight lines with trapezoidal profiles, calculated in real time using the robot's position, velocity, and camera feedback.
Ball Color Detection (CV)
Embedded cameras were used for ball sorting. The captured RGB565 image was converted to HSV colour space. The mean values of hue, saturation, and value, along with variance, were analysed to determine if the camera was obstructed by an empty grain or a paddy rice. This information guided the robot's intake and sorting decisions.
Sensor Fusion & Localisation
We used XY-encoders, IMU, lasers, line sensors, and limit switches to maintain accurate position. Lasers provided 1-D distance measurements for recalibration against walls. Line sensors helped track white lines on the field. Limit switches triggered when the robot hit a fence, providing a hard reference point.
Trajplanner Upgrades (Cross-cutting)
As the maintainer of Trajplanner (the team's tool for drawing Bézier paths), I made several improvements that benefited both R1 and R2:
- Help Window: Added in-app guidance so new members could learn without searching for documentation.
- Flipping Functions: One-click left-right flipping for symmetrical fields saved hours of manual adjustment.
- Start/End Velocity Control: Rediscovered hidden parameters and exposed them in the GUI. Applied to WD R2's starting path, enabling a jump-start during competition.
- Memory Optimization: Analysed flash usage and removed redundant data, but this was not merged in time for competition due to lack of testing.
Test Results & Lessons Learned
- The robotic arm library highlighted the difficulty of precise control with backlash - a simpler mechanism might be more reliable for future competitions.
- Dynamic pathing in Area 3 worked well, but better sensor fusion (e.g., using LiDAR) could improve robustness.
- Trajplanner improvements were well received; the Help Window and flipping functions significantly boosted team productivity.
Awards & Recognition
- 🏆 ABU Robocon Hong Kong 2024 - 2nd Runner-Up (War Dragon)
- 🏅 ABU Robocon Hong Kong 2024 - Best Team Spirit Award