View Single Post
  #1   Spotlight this post!  
Unread 24-01-2005, 17:19
Don Reid Don Reid is offline
Registered User
#0997
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Corvallis, Oregon
Posts: 45
Don Reid will become famous soon enough
Question PID code questions

In the pid code from First's "Navigation" sample, there is something I don't understand.

The integral error is combined with "pid_time", which is unfamiliar to me, I thought the integrated error (sum) should just used as is.

motor_info[motor].pwm = (KP_P * motor_info[motor].pos_error) +
((KI_P * motor_info[motor].pos_error_i)/pid_time) +
(KD_P * motor_info[motor].pos_error_d);

This pid_time variable is reset when the target position (or velocity) is changed,
but the integral value is not also cleared. Won't that cause problems?
__________________
Don Reid