|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help with PID
So we wrote PID code for our robot and it is acting very strangely. Encoders seem to be working fine, but on one side the talons go far past the set point and on the other side they approach it then change direction. We printed out the error and confirmed that it is decreasing and is correct. Even when we only use the proportional value, and the error is positive, for some reason one side decelerates and switches direction. We tested code that worked on last years robot with slight modification like changing victors to talons and it acted the same way.
|
|
#2
|
|||||
|
|||||
|
Re: Help with PID
Are these drive motors? If so, is your robot up on blocks? Trying to tune a closed-loop controller with no load on the wheels is going to be a frustrating exercise, as there is going to be a lot of overshoot and very little damping.
You might be able to get it to work adequately if you limit the rate at which the motor speed command can change. But it's really going to have to be run on the carpet in order to get it dialed in properly. |
|
#3
|
|||||
|
|||||
|
Re: Help with PID
If these are drive motors, or are otherwise oriented in opposite directions, you need to either use the invertedMotor() method during initialization on one side, or use negative PID constants as well as using negative speed settings in your drive functions. The advantage of using invertedMotor() is that you do it once, and don't worry about what is positive or negative anywhere else.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|