Balancing on a ball.
I am building a ballbot: a robot that stands on a single sphere and drives it with three omni-wheels. Before any hardware, the model. Derive the kinematics, the full non-linear dynamics and the linear model a controller needs — then try to keep it upright yourself.
One ball, one body, three wheels.
Everything starts from a sketch: name every body, parameter and coordinate before writing a single equation.
Bodies
A body A balances on a ball B that rolls on the floor 0. Three omni-wheels W₁, W₂, W₃, mounted on the body, touch the ball at a zenith angle and drive it. Their passive rollers let the ball slide along each wheel's axle, so every wheel only pushes along its own rolling direction.
| 0 | Floor, inertial frame, world axes (z up) |
| B | Ball, solid sphere, |
| A | Body: drive plate, motors, battery, mast, computer, IMU, lidar. Centre of mass G. |
| W₁₋₃ | Omni-wheels, massless in the model; motor torque between A and Wᵢ |
| H, T | Two massless virtual bodies that carry the coordinates: heading and tilt |
Parameters
Side view. G sits at height above the ball centre; each wheel touches the ball at from the vertical.
| ball radius | 120 mm | |
| omni-wheel radius | 50 mm | |
| zenith angle of the contacts | 50° | |
| wheel azimuths | 0°, 120°, 240° | |
| height of G above the ball centre | 300 mm | |
| ball mass, inertia | ||
| body mass | 12 kg | |
| tilt and yaw inertia about G | 0.9, 0.12 kg·m² |
Coordinates
The ball centre is at . The body orientation is described by three angles: heading , pitch and roll . The ball has its own orientation, and each wheel its angle .
Yaw, pitch, roll.
Three successive rotations, one per joint of the chain floor → H → T → A. A formalism that is easy to get wrong, so let's play with it.
Three elementary rotations
A rotation matrix stores the new axes, written in the old ones, as its columns. With the right-hand rule, the three elementary rotations are
The minus sign of sits bottom-left: for a rotation about y the cyclic order is z → x. On the right, the robot plays the chain: yaw about gives H, pitch about gives T, roll about gives A.
Compose them yourself
Read left to right: rotate about z, then about the new y, then about the newest x (intrinsic, how the joints are stacked). Read right to left: the same rotations about the fixed axes, in reverse order. Each ring on the right is one joint.
Angle rates are not the angular velocity
Angular velocities add along the chain, each joint turning about its own axis:
Bringing every axis into body components gives
The map from to has determinant : at yaw and roll line up (gimbal lock). A balancing ballbot never gets there. Drawn on the right for rad/s at the angles you set.
Rolling, without slipping.
Two kinds of contact: ball on floor, wheel on ball. Each is a constraint on velocities, not on positions.
Ball on the floor
The ball particle touching the floor, at , has zero velocity:
The vertical row reads 0 = 0: the floor does not fix the spin . Only the wheels can spin the ball about the vertical.
The wheel equation
Rim and ball surface must agree along the rolling direction. Both bodies share the ball centre, so only rotations matter:
Stacked for the three wheels (rows of are , here ):
is invertible for : any relative rotation between ball and body is reachable with three wheels. On the right, the wheels turn at exactly this rate while the ball rolls.
Inverse of JJ⁻¹
Six equations, three motors.
The full non-linear 3D dynamics, written for the body and the ball separately, then glued together by the motor torques.
Free-body diagram
Rigid bodies, massless wheels and ideal rollers, rolling without slip. Because the wheels are massless, each motor torque passes straight through as a couple between body and ball. Power balance gives
On the right, the body is lifted off the ball. : contact force of ball on body, : floor reaction, .
Newton–Euler, then eliminate the contact forces
Substituting and leaves six equations in the angular accelerations and the motor torques:
Every term, expandednon-linear
All vectors in world axes. Orientation and centre of mass:
Accelerations (rigid body, then rolling):
World inertia of the axisymmetric body, which changes as it tilts (hence the gyroscopic term):
Angular velocities, from chapter 2 and the ball speeds given in H axes:
Cross-checked numerically (9–10 digits) against the equations KineSketch generates symbolically from the same sketch (sympy, Kane's method).
Why it has to balance
Add the two equations: the motors cancel. What is left is the angular-momentum balance about the floor contact point:
Gravity on the tilted body, , can only be countered by accelerating the ball and the body. The motors never push on the world directly: they move the ball under the body. Only the ball spin about the vertical is driven directly, by the vertical row of the ball equation: .
Lean to accelerate.
Cut the problem along one axis: motion along x, pitch ϑ. Two degrees of freedom, still fully non-linear.
The forward lean
For a steady acceleration (), gravity must supply the opposite moment, so the body leans forward:
The last term is the drive reaction. It makes the lean larger than the naive pendulum answer .
One unstable pole.
A controller is designed on a linear model. Linearize about the upright equilibrium.
Small angles
About : , , and is second order. The planar model becomes
On the right: the non-linear model with the motors off, released from 1°. It falls in well under a second.
State space
With the state and , invert (det = 17.45 kg²m²):
Eigenvalues of : with = 5.575 rad/s.
Check: = 15.36 kg, = 3.60 kg·m, = 1.98 kg·m².
Your turn: keep it upright.
Two controllers on the same non-linear model. LQR uses the full state; a cascaded PID only uses the tilt and an outer position loop. Push the robot and compare.
[-2.00 -34.10 -3.96 -6.94]From model to metal.
- Done: kinematic and full non-linear dynamic model, planar and linear models, checked against symbolic equations generated by KineSketch, my kinematic sketching tool.
- Next: a 3D controller on the full model, state estimation from the IMU and wheel encoders, then the hardware build — motors, drivers, ball, frame.
- Model limits: massless wheels, ideal rollers, no slip and no friction losses. The 3D playground runs two decoupled planar models, valid near upright.