6 years after competing, solving the same challenge with EKF, MPC, and trajectory optimization.
In 2019, my team placed top 10 in Germany at the World Robot Olympiad Senior category. Our solution used line following, dead reckoning, and reactive behavior on a Lego EV3 platform.
6 years of studying Mechanical Engineering at TUM and Robotics at BU later — how would I solve this today?
Watch the original 2019 competition run
The WRO 2019 Senior challenge requires a robot to autonomously navigate a field, scan colored routers, determine delivery order, and transport objects to designated zones — all under time pressure.
Since I don't have access to the original Lego parts, this is a pure simulation based on best estimates of motor errors observed during competition.
| Component | Approach |
|---|---|
| Localization | Extended Kalman Filter — fuses encoder odometry with continuous RGB photometric measurements from a pixel-perfect field representation |
| Planning | Hermite-Simpson collocation for smooth trajectory optimization between waypoints, pre-computed trajectory library |
| Control | Model Predictive Control with adaptive horizon, contouring control in Frenet frame, dynamic model with mass/inertia |
| Field | Actual WRO field PDF → 6695×3240 numpy array (0.35mm/pixel), exact color sampling at any position |
┌─────────────────────────────┐
│ run_challenge.py │ Game logic, trajectory selection, animation
└──────────────┬──────────────┘
│ Trajectory to follow
▼
┌──────────────────────────────────────────────────┐
│ RobotSystem │
│ ┌────────┐ ┌───────┐ ┌─────────┐ ┌───────┐ │
│ │ MPC │→ │ Robot │→ │ Sensors │→ │ EKF │ │
│ └────────┘ └───────┘ └─────────┘ └───────┘ │
│ │
│ Control → Motion → Sensing → State Estimate │
└──────────────────────────────────────────────────┘
The game logic never touches velocity or control — it only knows about trajectories and destinations. This mirrors how real robot software is structured (cf. ROS move_base).
- Pixel-perfect field: The actual competition field PDF is converted to a numpy array, preserving every color boundary at 0.35mm resolution
- Industry-standard architecture: Clean separation of concerns with dependency injection — every component is independently testable
- Velocity-based control interface:
execute_velocity_command(v, ω, dt)matches the ROScmd_velstandard - MPC with adaptive horizon: Preview time adjusts based on velocity and stopping requirements
- Contouring control: Tracks cross-track error and lag error in a Frenet frame, not just waypoint distance
- Game state machine: Decision tree for optimal router scanning order based on observed positions
# Setup
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
# Generate trajectory library (required before first run)
python -m src.navigation.planning.trajectory_library
# Run the full simulation with real-time visualization
python run_challenge.pywro_2019/
├── run_challenge.py # Main simulation + animation
├── src/
│ ├── config.py # All tunable parameters
│ ├── game/ # Field, game logic, routers, obstacles
│ ├── hardware/ # Robot dynamics + sensor models
│ ├── system/ # RobotSystem orchestrator
│ ├── navigation/
│ │ ├── localization/ekf.py # Extended Kalman Filter
│ │ ├── planning/ # Trajectory optimization + library
│ │ └── control/mpc_controller.py # Model Predictive Control
│ ├── visualization/ # Modular matplotlib visualization
│ └── common/ # Shared types
└── tests/ # EKF, MPC, trajectory optimization tests
Developed for EK505 Dynamics Modeling and Intro to Robotics at Boston University.
Cornelius Gruss — Robotics and Autonomous Systems, Boston University