so I am working on a Self Balancing Bot with Arduino Mega. I'm using 12V 200 RPM motors with built in 840 PPR quadrature encoders. The torque rating is as follows:
Rated Torque: 2.4 Kg-cm Stall Torque: 6 Kg-cm
As of now I've implemented a simple PID controller (based on Brett Beauregard's PID library) to minimize only the tilt angle error. Still haven't implemented PID using the encoder for the position error.
I've tried a lot to tune the PID values. The robot is quite stable when it is standing its own. However, here's the issue, when the robot tilts by an angle greater than 7-8 degrees (or when it is pushed slightly) from its stable position, the motors start rotating at the maximum speed (PWM: 255) and the robot still doesn't seem to recover back and just keeps running and then finally falls down in the direction in which it was moving. It doesn't seem to recover at all.
Is it just a problem with the PID tuning? As I said earlier, it's stable for the range -5 to +5 degrees (0 degrees is the upright position) without oscillating much. However it is not able to recover for errors greater than 7 degrees.
Or could this be an issue with the robot being too heavy and insufficient counter motor torque? Total weight of the robot is around 1 kg (including the motors). I'm using 2200 mAh LiPo battery and have placed it at the highest level so as to decrease the angular acceleration.
Would implementing the PID feedback for encoders as well solve this issue? Also do suggest some links on how to implement dual PID using an IMU and encoders to correct tilt angle and position. I'm planning to use cascaded PID controllers in which the encoder PID measures the error in position and its output will be the set-point for the angle PID loop which in turn will control the PWM of the motors. So if there's an offset in position the angle set-point will change to, let say -2 degrees (from upright 0 degrees). So now the angle PID will make the robot move in order to correct the angle offset and therefore the position error also gets corrected. Is this a good method. Any other suggestions or different approaches to this?