The Centre of Gravity
The stabilisation algorithm for the T-Bot requires the centre of mass to be known. Here are two simple methods for finding this.
Method One
Rest the T-Bot on a ruler. Move the T-Bot around until it is balanced and measure the distance from the ruler to the farthest edge of the wheel.
Method Two
Attach some string to the T-Bot as shown below. Allow the T-Bot to swing with a small amplitude and use a stop watch, measure the period which is the time required for one complete oscillation. You will get better results if you measure the time required for ten oscillations and divide it by ten. Use the pendulum equation to find the length of the pendulum and subtract the length of string above the wheels from the total length to find the centre of gravity of the T-Bot.
Practical Experiment
Use the methods above the determine the distance from the centre of gravity to the farthest part of the wheel. Set h equal to this value in the following snippet of code found in TBot.ino:
float g = 9.81, pi = 3.1416, h = 0.08; // physical constants