|
Re: Problems with Automatic Target Alignment
PID uses the I term to push harder if the mechanism doesn't move right away. Set the P constant just low enough to avoid oscillation, then crank up the I until it moves reliably. Use the D term to compensate for rotational momentum so you won't keep accelerating once it gets moving "fast enough" and you'll give the robot a chance to slow down as it approaches the target.
You might have to do some back and forth adjustment of P and I, as they're both contributing to control in the same direction, and once the robot starts moving they're reinforcing each other.
Watch out for how you're closing the feedback loop, though. You can't just use the vision target output as the feedback signal, because it will be delayed enough to make your robot turning oscillate even with a well-tuned PID controller. Instead, use a gyro to measure your current heading and use the vision system to decide what your desired heading will be. Only take a new vision reading once the robot direction has settled down, so you know you're getting a value that reflects "now" instead of one that was derived while the robot was pointing somewhere else.
|