![]() |
PID Controller behaving erratically
This year, my team is trying to get our robot to drive straight using a PID controller and a NavX rather than having our driver correct for it manually. However, whenever I do this, the robot seems to shake left and right. I've tried raising/lowering the P value to get the robot to oscillate around the 0 degree mark, but once it gets to the point, it starts to shake rather violently. Changing the D value seems to make next to no difference, and if anything the robot seemed to shake more violently.
From some googling, it seems that the cause is a P value that is too high, but I can't seem to find a P value where the robot doesn't either shake, brown out, or not have enough power to move. I've posted the relevant pieces of my code below. Can someone help me out? Thanks so much. Code:
public class Robot extends IterativeRobot implements PIDOutput { |
Re: PID Controller behaving erratically
Check out this thread: http://www.chiefdelphi.com/forums/sh...d.php?t=142349
|
Re: PID Controller behaving erratically
Quote:
|
Re: PID Controller behaving erratically
Set the kP just low enough that you don't get oscillation. As you've seen, that doesn't always give enough power to get to the desired target, and you get a steady-state error. Now increase kI just high enough to overcome that error. Then tweak kD to account for rotational inertia so it doesn't overshoot badly and oscillate again.
It helps if you can modify the PID constants while the code is running. Perhaps you could use SmartDashboard for that. |
| All times are GMT -5. The time now is 00:43. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi