|
Re: Gyro Drive Straight
If you know what direction you want the robot to face, and you know what direction it is currently facing, you can use the difference between them to control the "turn" input of either a Mecanum or Arcade drive function.
If you scale the values properly, that will tend to rotate the robot toward the desired direction. That's a simple Proportional control system, which is what the "P" in "PID" stands for. If you find that you can't get the robot to hold its direction strongly enough without overshooting and oscillating, then you need to implement a more complete PID control with some Integral to account for the steady-state error, and perhaps some Derivative to reduce overshoot when the error starts out too high.
|