To be honest I have been putting off showing my monstrosity of control theory but I am in dire need for direction and suggestions.
Project: 2DOF inverted pendulum.
Hardware: 2 x 29:1 12V Gearmotors, SN754410NE H-Bridge, Arduino Nano 3.0, Sparkfun 5DOF IMU.
What works thus far: The system can respond to positive and negative roll, data acquired from y_acc and z_acc data, with a complementary-ish filter combining the roll values at with sensitivity of 9.1mV/degree/s. Currently is can reach overshoot at a very small tilt, once this has adjusted once or twice it begins to dramatically overshoot, which leads me to my next point.
What doesn't ... : I am not completely sure my complementary filter is working that brilliantly, I have done some minor tests, and my output angle only varies slightly with translation in the z and x axes, this is due to the contribution from the accelerometer. I don't seem to get drift.
I have had a lot of issue with the motors and wheels, not enough torque, not enough speed, wrong shaft sizes, etc... Basically, I am fairly certain the 350rpm no load is fast enough to response in my system, I CANNOT get any more motors due to budget restrictions. So the issue here is the PID values currently I have,
void pid() {
err = setpoint - alpha;
if ((err > -.01) && (err < 0.01))
{
err = 0;
}
PID = kperr + ki(err - prev_err) + kd*(err - prev_err)/dt;
PID_comp = PID*a;
PID = abs(PID);
PID_comp = abs(PID_comp);
if (PID > 255)
{
PID = 255;
}
if (PID_comp > 255)
{
PID_comp = 255;
}
prev_err = err;
}
What I'd love: Obviously it balancing, but I would love to implement a good filter, complementary or kalman. Accurate PID control of motors.
Any help or direction happily accepeted!