I've already built a two wheeled balancing robot using some continuous rotation servos and an accelerometer/gyroscope. I upgraded the servos to some geared DC motors with 8-bit encoders with the goal having the robot drive around while balancing.
I'm kind of stuck on how to program it to drive around while still balancing. I think one way would be to just have the control input to the motors act sort of like pushing it. So the robot would be momentarily unbalanced in the direction I want it to travel. That seems kind of clumsy to me though. There must be a better way of doing? I think I need to combine the dynamic model for the balancer with the differential drive but this is a bit beyond the control theory that I know.
Update From Anorton's answer I have a good looking state matrix now.
Now about pole placement: The A matrix will will have to be 4x4 based on the new state vector. And B will then have to be a 4x2 matrix since I can only control the left/right wheel torque (u = 2x1 vector).
I may need to read more about this but is there a systematic way to determine the A matrix by pole placement? It seems to me for this example and even more complicated examples, determining A by guess and check would be very difficult.
Update #2 After a bit of reading I think I understand it now. I still need the dynamics of the robot to determine the A matrix. Once I have that I can do the pole placement using matlab or octave.
:)
My controls knowledge is very slim, but I'll throw my $0.02 worth in there... $\endgroup$