Thread: RPM calculator
View Single Post
  #14   Spotlight this post!  
Unread 01-03-2012, 17:30
ProgrammerMatt ProgrammerMatt is offline
Programmer-Electrical-Mechanical
FRC #0228 (Gus)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Southington
Posts: 138
ProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really niceProgrammerMatt is just really nice
Re: RPM calculator

Quote:
Originally Posted by lineskier View Post
Get rate is not ideal.

We store a last time variable.

Take counter.getdistance / (current time - last time)

Then reset the counter.

You will get a much stabler speed this way

this is straight out of the encoder class
Code:
     * Get the current rate of the encoder.
     * Units are distance per second as scaled by the value from setDistancePerPulse().
its practically the same as current time - last time
Reply With Quote