Combining Vision, Machine Learning and Automatic Control to Play the Labyrinth Game

Kristoffer Öfjäll, Michael FelsbergarXiv 2016

Introduction

The classic BRIO labyrinth game presents a significant challenge for robotic control. While guiding a marble through a maze by tilting the board seems simple, the underlying physics are riddled with non-linearities. Factors such as surface irregularities, rail friction, and complex dynamics near obstacles or holes make precise modeling difficult. Traditional control methods like Proportional-Integral-Derivative (PID) struggle with these localized variations, while pure machine learning approaches often suffer from high data requirements before achieving basic functionality.

System Architecture

To address these challenges, researchers developed a hybrid system that combines deterministic control with adaptive learning. The architecture consists of three primary components:

  1. Computer Vision and State Estimation: A top-down camera tracks the marble. Using a homography transformation, the system produces a rectified view of the maze. A Kalman filter then processes this data to provide stable estimates of the ball's position and velocity.
  2. The PID "Teacher": A hand-tuned PID controller provides initial control signals. This serves as a baseline and a "teacher" for the learning algorithm, allowing the system to begin operating immediately without a lengthy pre-training phase.
  3. The LWPR "Student": The core of the system is Locally Weighted Projection Regression (LWPR). Unlike global models, LWPR employs multiple local linear models. Two versions were tested: LWPR-2, which learns mappings based on velocity, and LWPR-4, which incorporates absolute position to account for spatially varying dynamics.
The experimental setup including the maze, camera, and control interface.

The system operates by allowing the LWPR model to observe the PID's actions and the resulting ball movements. Over time, the LWPR builds an internal model of the inverse dynamics. Once sufficiently trained, the LWPR takes primary control, reverting to the PID only when encountering unfamiliar states.

Experimental Scenarios

The system was evaluated across three distinct scenarios designed to test its adaptability:

  • Scenario 1: Following a sine-shaped path on a flat board.
  • Scenario 2 (The "Glitch" Test): Artificially altered dynamics, including a constant tilt offset (2a) and completely reversed control logic (2b) in the bottom half of the board.
  • Scenario 3: Navigating a standard BRIO labyrinth with walls and holes.

Results and Analysis

The primary metric for performance was the Root Mean Squared Orthogonal Error (RMSOE) in millimeters. The results highlight the superiority of the LWPR-4 model, particularly in complex environments.

Scenario PID (Teacher) LWPR-2 LWPR-4 (Winner)
1 (Sine) 6.0 3.5 3.7
2a (Offset) 15.5 11.5 6.5
2b (Reversed) DNF DNF 5.6
3 (Real Maze) DNF DNF 3.8

A key finding was the importance of positional data. LWPR-4 was the only controller capable of completing the reversed-logic and real-maze scenarios. While the PID controller often succumbed to oscillations in the real maze, the LWPR-4 learned to dampen these effects, achieving an error of just 3.8mm.

Learning progress in Scenario 2a, showing LWPR-4 (dot-dash) significantly reducing error compared to the PID baseline (solid blue).

As shown in the performance data for Scenario 2a, the learning controllers quickly reduce their error below the PID baseline. LWPR-4, by accounting for the spatial "glitch," achieves the most stable and accurate performance.

Conclusion

By combining the immediate utility of PID control with the adaptive power of LWPR, this hybrid approach successfully masters the labyrinth game. The system not only learns to mimic its teacher but eventually surpasses it by accounting for complex, spatially-dependent physics that hand-tuned controllers cannot easily capture. Future work may explore integrating path planning into the learning model or applying these techniques to higher-speed physical systems.

Summary updated

BibTeX
@misc{ofjall2016combining,
  author = {Kristoffer Öfjäll and Michael Felsberg},
  title = {{Combining Vision, Machine Learning and Automatic Control to Play the Labyrinth Game}},
  year = {2016},
  eprint = {1604.00975},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1604.00975},
}
Figure