Master thesis — MSc Mechatronics & Control Engineering, Aalborg University (2020) Cristina Roche · Victor Borja — supervised by Jan Dimon Bendtsen and Juan de Dios Flores Mendez
A ballbot balances on a single sphere driven by three omniwheels: omnidirectional, underactuated,
non-minimum-phase, and open-loop unstable — five degrees of freedom, three actuators, a MIMO control
problem with no room for hand-waving. This repository contains the full thesis (thesis.pdf, 184 pp),
the MATLAB/Simulink models, and the modifications we made to the robot's embedded firmware and ROS stack.
- Quaternion Lagrangian model. Orientation represented with unit quaternions (no gimbal lock); the quaternion constraints are handled through a diffeomorphism that yields a closed-form, control-affine ODE suitable for nonlinear control design.
- Quaternion Unscented Kalman Filter (QUKF). A UKF variant that preserves the quaternion's unit norm through the sigma-point algebra — naively re-normalizing after the additions and subtractions of the standard UKF visibly corrupts the estimate.
- Velocity UKF (VUKF). Velocity estimation from encoder + IMU with explicit sensor noise models (accelerometer, gyroscope, encoders).
- Cascade control. An I-LQR velocity controller in the outer loop generating references for a nonlinear Feedback-Linearization balance controller (adapted to quaternions and MIMO) in the inner loop, benchmarked against a Sliding-Mode Controller.
- Robustness studies. Mass/inertia disturbances, force pushes, and center-of-mass misalignment — the last one produces a run-away that the balance controller alone cannot fix; the velocity loop resolves it by re-computing the equilibrium point.
Honest findings (Chapter 10): the UKF's extra complexity did not pay off against the simpler EKF for this system, and FLC ≈ SMC in tracking performance. Both null results are stated plainly in the thesis — knowing when the fancier method isn't worth it is part of the engineering.
Performance (simulation, sensor noise + estimators in the loop): near-zero roll tracking error, pitch within ±0.2°, yaw within ±0.08° under sine references.
Force-push disturbance rejection with the cascade FLC controller.
| Path | Content |
|---|---|
thesis.pdf |
The full thesis report |
simulink/Model/ |
Euler–Lagrange derivations (quaternion & planar), closed-form ODE |
simulink/Estimators/ |
QUKF, VUKF, QEKF, Madgwick |
simulink/Controllers/ |
Feedback linearization, sliding mode, velocity LQR |
simulink/Simulation/ |
Top-level closed-loop simulations |
simulink/Parameters/ |
Physical & tuning parameters |
simulink/SuperTwisting_experiments/ |
Super-twisting SMC side experiments |
figures/ |
Robot CAD, architecture diagrams, and all result plots (SVG) |
platform-patches/ |
Our changes to the Kugle firmware/ROS/MATLAB repos, as git patches |
MATLAB R2019b with Simulink 10. Add simulink/ to the MATLAB path, then open e.g.:
simulink/Simulation/BallRobot_FBL_reference_tracking.slx— feedback-linearization reference trackingsimulink/Simulation/BallRobot_UKF.slx— estimators in the loopsimulink/Simulation/BallRobot_ST2SMC.slx— super-twisting sliding mode
The physical platform is the Kugle robot developed at Aalborg University by Thomas Kølbæk Jespersen — Kugle-MATLAB · Kugle-Embedded · Kugle-ROS — whose V2019 system (sliding mode + EKF) is the baseline we compare against throughout.
Our thesis work extends the modeling to quaternions, introduces the UKF estimator pair, and replaces
the balance controller with feedback linearization. The controller was also brought onto the real
robot's stack: platform-patches/ preserves our commits to the embedded firmware
(STM32H7, C++) and the ROS driver as git format-patch series against the upstream SHAs listed in
platform-patches/MANIFEST.txt.
The ETH Zürich Rezero project and previous AAU ballbot theses informed the design space.
@mastersthesis{RocheBorja2020Ballbot,
title = {Control of a Ball-Balancing Robot},
author = {Roche, Cristina and Borja, Victor},
school = {Aalborg University},
year = {2020},
note = {MCE4-1027, Energy Engineering --- Mechatronic Control Engineering}
}Code and models: MIT. Thesis text and figures © 2020 the authors (Aalborg University student report).

