|
Re: Turning Robot with PID Feedback from Gyro
It's been a while since I've done a PID loop for a drivetrain, but I think with a P of 1.0 your drive will always be turning at full power. That is because the drive accepts an input from -1 to 1, and the PID loop starts by multiplying the error by the P, which will make the output be greater then 1 whenever you are more then 1 degree off. Also, you do need to limit the PID output to be between -1 and 1 because thats the range motor outputs want.
Most likely the robot is turning the wrong way compared to the Gyro, just like notmattlythgoe said. To fix this you could return the negative gyro output, or reverse the PID output.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
|