![]() |
PID Problems
Hey guys! I'm a senior from Salt Lake just getting into FIRST. I am new to java and I'm having some trouble specifically with my PID loop. As I understand it the PIDController function should take input from my encoder and send output to my motor (arm). The code builds with no errors but I am seeing no motion in the arm motor, I am using an encoder value of 250 as my setpoint just for testing purposes. If anyone can lend me some advice as to how I'm screwing this up that would be greatly appreciated! :deadhorse:
Code:
package org.usfirst.frc.team4598.robot; |
Re: PID Problems
I am on mobile so I apologize for this being short. In teleopPeriodic, get rid of the line that says arm.set(). You do not want to directly control the motor that the PID is controlling as they will fight each other. The reason that the PID is not doing anything, is because you constructed it with a KP, kI, and kD of 0. Right above the constructor for the PID controller, you declare those variables but you never give them values. I would start with a P term of ...well I have no idea... but start with a P term that is small like .01 or even smaller like .005. Increase your P term until you get motion that is close to your desired result or perhaps a little bit of overshoot if that is OK. If your P term is too large then you will over shoot your target and it will oscillate. If you don't want it to over shoot the target make the P term smaller, in which case it might stall out. You can add a D term to help with oscillation or an I term to help a stalled out process.
Good luck. |
Re: PID Problems
Thanks so much! Its working great now just need to tune haha :yikes:
|
Re: PID Problems
Hi, same topic different problem. I have tuned my P to .06 and my D to .005 which seems to work fairly well. The arm can quickly find and hold its position but it will periodically spike, I know some amount of this is normal but if anyone has any suggestions I would really appreciate the advice! :D Here's a video:https://youtu.be/_GVL4oMagSA
|
| All times are GMT -5. The time now is 08:58 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi