|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools |
Rating:
|
Display Modes |
|
#1
|
|||
|
|||
|
Unexpected results from Encoder::GetRate()
I'm trying to set up a speed controller using the US Digital E4P-250-250-D-D-D-B encoder and the WPI Encoder class. Everything basically works fine but I'm seeing an odd discrepency between the values out of GetRate() and GetDistance(). Spinning the encoder at a constant rate, I would expect that the rate returned by GetRate() (units/sec) would more or less match the one-second delta returned by GetDistance(). But what I see is this: the distance returned for one second is almost exactly half of GetRate(). Because GetRate() is fairly noisy, I'm testing using a 20 sample moving average (with a sampling rate of 40hz). I'm sure I'm missing something obvious... Can one of the WPIlib experts here clue me in on what it is? Thanks!
Update, possible clue: Looking through the WPI source I noticed this comment in Counter.cpp (used by 1x and 2x Encoder): /* * Get the Period of the most recent count. * Returns the time interval of the most recent count. This can be used for velocity calculations * to determine shaft speed. * @returns The period of the last two pulses in units of seconds. */ double Counter::GetPeriod() Last edited by LyraS : 02-08-2010 at 02:26 PM. Reason: Update... more info |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [BB] An unexpected change in plans | yodameister | General Forum | 22 | 12-01-2009 09:26 PM |
| Inconsistent reading from encoder get rate | rwood359 | National Instruments LabVIEW and Data Acquisition | 5 | 01-13-2009 07:10 PM |
| Results from Drexel, thanks from 365. | archiver | 2001 | 1 | 06-24-2002 02:44 AM |
| Results from GLR? | archiver | 2001 | 0 | 06-24-2002 02:44 AM |
| results from regionals | archiver | 2000 | 0 | 06-23-2002 10:31 PM |