View Single Post
  #14   Spotlight this post!  
Unread 28-01-2012, 11:35
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: Speed PID Function

Quote:
Originally Posted by John_1102 View Post
I understand the theoretical stuff with the PID now.
I just need some psuedo-code or something to help me implement it.
I'm currently clueless.
Code:
previous_error = setpoint - process_feedback
integral = 0
start:
  wait(dt)
  error = setpoint - process_feedback
  integral = integral + (error*dt)
  derivative = (error - previous_error)/dt
  output = (Kp*error) + (Ki*integral) + (Kd*derivative)
  previous_error = error
  goto start
Straight from: http://en.wikipedia.org/wiki/PID_controller#Pseudocode
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.