Fixed Point Solution

The calculations involved for finding the new rate at which the disc should spin after a ball has dropped are complex and need to be done quickly. A fixed point solution was implemented because the Luminary micro-controller can not do floating point calculations quickly.

Calculating Time To Impact (Tc)

To solve the kinematics of the system, we needed to determine the Time To Impact (Tc) based on the distance between the sensor, distance from the sensors to the disc, and the time it took for the ball to pass through the sensors. First we find the initial velocity (v0), which is the velocity of the ball as it leaves the bottom sensor.

v0 = Initial velocity (velocity of the ball as it leaves the bottom sensor
hdrop = Distance between the 2 sensors
g = Gravitational acceleration (approximately 9.8 m/s)
tdrop = Time it took for the ball to drop through the 2 sensors


Once we find the initial velocity (v0), we can directly calculate the Time to Impact (Tc) using the following equation:

Tc = Time to Impact (time it will take for the ball to drop from the bottom sensor to the disc)
v0 = Initial velocity (velocity of the ball as it leaves the bottom sensor
z0 = Distance from the bottom sensor to the disc
g = Gravitational acceleration (approximately 9.8 m/s)


Since the equations involved in finding Time to Impact (Tc) involved complex floating point calculations such as square roots, it was implemented as a look-up table. Using the 2 equations above, a matlab script was created to generate a look-up table of Time to Impact (Tc) based on tdrop.

Calculating Trajectory Correction Period (pc)

The calculation for the Trajectory Correction Period (pc) was more complicated due to the fact that it depended on 3 different variables: Current Position (θ0), current period (p0) and Time to Impact (Tc). So, we decided it would be easier to calculate the Correction Period (pc) directly (using 2 divides and 1 modulo)than to try to make it into a 3-dimensional array.

pc = Trajectory Correction Period (the new disc period needed for the ball to pass through the hole)
Tc = Time to Impact (time it will take for the ball to drop from the bottom sensor to the disc)
p0 = Current period of the disc
θ0 = Current position of the disc
R = Value of one rotation (number of encoder ticks in one rotation)