
#MAGIC TOUCH SPACECONTROL SERIAL#
The timestamps and ball coordinates were sent to the serial port:

In order to find C, the platform was tilted one unit to the right and the ball was rolled several times toward the left. This relationship, including the small angle approximation of tilt angle (a = sin(theta) ≈ theta) and conversion to digitizer units, is all incorporated into the constant C. We need to find the value of C such that it incorporates the relationship between the control input, u, the degree of tilt in the table, and the resulting acceleration on the ball. The only way to control the position is by changing the tilt of the table. Given the relationship dx/dt = v, the state matrix equation is: Let the state, x, of the table include 2 variables, position and velocity, x and v. But the magic of state space control has solutions for this in the form of robustness methods.įortunately the dynamics of the table are not too complicated. any deviation from the ideal dynamics described in your equations will lead to steady state error. The steady state error of plain vanilla state space control is horrible- i.e.

I had naively believed that the magic of state space would take care of steady state errors.
#MAGIC TOUCH SPACECONTROL TRIAL#
After a lot of parameter tuning and more trial and error than I care to admit, it worked- sort of. I want to go back to these at some point.
#MAGIC TOUCH SPACECONTROL FULL#
I also tried to use a linear quadratic regulator for the full linear quadratic gaussian (LQG) enchilada. I tried to use a Kalman filter as an observer because the resistive touchscreen sometimes glitches (perhaps from small dead spots in the resistive layer).

I think I bit off a little too much the first time around. It provided almost all of the functionality of Matlab for this kind of work. The python control library ( ) was very helpful. I would like to share some of the things I learned along the way. I found the entire process in turns daunting and not so bad.

The platform is tilted using micro-sized hobby servos, $2 each. The ball position is sensed using a resistive touch screen picked up for $1.50 at AllElectronics. Last year, I built this low budget ball balancing platform with my kids. The convergence of math, electromechanics, sensors, and programming holds a place dear to my heart. I've been interested in control systems for a long time.
