|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
CAN Talon PID
I'm getting some weird results from my testing of the CAN Talon SRX built-in pid loop. Our setup has a ctre magnetic encoder plugged directly into the CAN Talon. I couldn't find a whole lot of documentation, but I did find some java examples using the links at the ctre website. We are using c++, so I did my best to "translate" some of the documentation into a c++ sample robot program. The functions are named the same and I don't expect them to be all that different between languages. My main problem is that changing the pid(f) values I give the pid loop actually changes how fast the motor's resting velocity is regardless of what I set the loop to. The speed seems to increase as I increase any of the four values. This obviously is not how pid loops are supposed to work. Any insight would be greatly appreciated!
|
|
#2
|
|||||
|
|||||
|
Re: CAN Talon PID
Have you verified that your sensor and your Talon agree on which way is forward (positive throttle should result in positive velocity, and visa versa)?
I'm not sure what you mean by resting velocity; the code you attached will have the Talon attempt to spin at 100rpm whenever the robot is enabled. Also, read this document very closely. Complexity aside, this is one of the best-documented pieces of hardware in FRC. |
|
#3
|
|||
|
|||
|
Re: CAN Talon PID
By resting velocity I mean that when I use the getEncVel() function, if I increase one of the pid(f) values the velocity that the function returns is higher than if I hadn't increased it. In other words I would get more than 100 rpm. As far as I know they agree on the forward direction, but I'll double check tomorrow. I have been reading the link you sent me a lot over this past week, but I haven't found anything pertaining to this problem.
|
|
#4
|
|||||
|
|||||
|
Re: CAN Talon PID
Important question. Are you using doing PID position control, or PID speed control?
The behavior you describe is somewhat expected for PID speed control. See this thread for some insight. |
|
#5
|
|||
|
|||
|
Re: CAN Talon PID
I wish I had found that thread when I was searching earlier. I'm doing a velocity closed control loop. If I understand correctly now, the FF needs to be adjusted until the encoder velocity matches the desired velocity, and then the other values (it seems mostly P and D) need to be adjusted to respond to changes in load, velocity, etc.
|
|
#6
|
|||||
|
|||||
|
Re: CAN Talon PID
Quote:
|
|
#7
|
|||
|
|||
|
Re: CAN Talon PID
After doing some testing the feed-forward value is responding as I expected, but the P value also increases the velocity the motor goes to, which is confusing me a bit. Should it react this way? I thought the P value was for oscillation around the value that FF goes to.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|