This open source project demonstrates how an x-IMU mounted within a rolling ball can be used to track the ball's position on a surface. The PC application created using the x-IMU API uses the gyroscope data, orientation data and known radius of the ball combined with a simple kinematic model to calculate the planar kinematics and update a 3D graphical output. The project also demonstrates an example mouse application where the ball's motion controls the mouse cursor and taps detected with the accelerometer represent mouse button clicks.
For more information and source code, see:
http://www.x-io.co.uk/rolling-ball-tracking-with-gyro/