View Single Post
  #23   Spotlight this post!  
Unread 29-01-2012, 01:11
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,058
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Speed PID Function

Quote:
Originally Posted by John_1102 View Post
this is where my confusion lies.
I thought the getRate function was reading the RPM's
I guess not.
I looked at the method itself and it shows that the equation for getRate is...

setdistanceperpulse/getPeriod or right now for me.

1/the time between each pulse

What my software mentor told me is that what were going to do is probably sample from the getRaw data encoder function.

since we are getting 2.5 revolutions per second @ 35% power based on a test I did. since there are 1440 pulses per revolution.
If your encoder is giving you 1440 pulses per second:

1 RPM = 1/60 rev/sec = 1440/60 pulses/sec = 24 pulses/sec

So RPM = (delta_pulses/dt)/24

...where delta_pulses is the change in the raw count from the previous cycle, and dt is the cycle time in seconds.

Don't forget: you must scale your setpoint to the same units as your process_variable.