Thread: PID help
View Single Post
  #2   Spotlight this post!  
Unread 03-07-2015, 05:21 PM
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,539
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: PID help

If, as it appears, you always use the same set point for both, you can either use two PIDcontrollers as you did, or create a virtual motor controller that actually sets both motor speeds from a single set() method. If these two motors are on the same gearbox and the controllers are set to coast, this second technique can also be used to reduce the size of the deadband; if below the usual deadband value, set one motor at zero and the other at twice the normally desired value.

At startup, assuming that the piece isn't moving, both I and D are zero, so the only way that get() should return zero is either if you are at the setpoint of 35, or if there is some sort of error/out of bounds issue.

If this is not the case, you should try printing the output of getError(), which will return the difference between the sensor output and the setpoint (35). If this value is not very close to zero, perhaps your tolerance is set too high. If it is zero or close to it, but your actuator is not in the correct speed/location, you should probably check the output values from the sensor; it may have gotten mechanically disconnected or otherwise always be reporting a number near 35.

Also, is 19 to 50 really the valid range of the potentiometer output? Out of context it seems peculiar, though perhaps it makes sense in your context.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote