|
|
|
| We win as a team. |
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
|||
|
|||
|
Re: Best way to measure period between pulses? Counters and FPGA
Quote:
Quote:
Cheers, -Joe |
|
#17
|
|||
|
|||
|
Re: Best way to measure period between pulses? Counters and FPGA
Quote:
The FPGA does not like to divide without using up a bunch of gates, where and the RT CPU with an FPU has no problem doing this. This is an optimization where all the addition and synchronization is done in hardware where it needs to be done, but the divide operation to get the actual average period is pushed to the driver. If you want "Method 1", you have to do it the way Ken Streeter described. If you want "Method 2", you must use the FPGA. Cheers, -Joe |
|
#18
|
|||||
|
|||||
|
Re: Best way to measure period between pulses? Counters and FPGA
Thanks for the correction, Joe! I'll edit my post above to fix it!
|
|
#19
|
|||
|
|||
|
Re: Best way to measure period between pulses? Counters and FPGA
Quote:
Quote:
No. The FPGA only implements method 2. |
|
#20
|
|||
|
|||
|
Re: Best way to measure period between pulses? Counters and FPGA
Quote:
|
|
#21
|
|||||
|
|||||
|
Re: Best way to measure period between pulses? Counters and FPGA
I had missed that in the original post. However, now I understand why the original poster doesn't want to use "Method 1." Given the statement of seeing RPM values with a resolution of 375 RPM and a hypothesized 20ms sampling period, their system must be using a wheel that has only 8 counts per revolution. In order to get greater RPM measurement resolution while keeping their 8 CPR sensor, they would need to have a longer sampling interval (longer than 20ms).
Similarly, with a 250 CPR sensor such as 1519 used in 2012, our computed RPM values are discretized at units of 12RPM. Measuring wheel speed to the nearest multiple of 12RPM was fine for our wheel shooter last year. Measuring to the nearest 375RPM might be troublesome. |
|
#22
|
||||
|
||||
|
Re: Best way to measure period between pulses? Counters and FPGA
Quote:
|
|
#23
|
||||
|
||||
|
Re: Best way to measure period between pulses? Counters and FPGA
Quote:
How is this implemented under the hood in FPGA? Is there a ring buffer in the FPGA which the FPGA populates with the 6.525us_resolution_timestamp for each rising edge it detects (assuming it's not in semi-period mode), and then when requested retrieves the elapsed time between the N+1 most recent samples in the ring (which the cRIO CPU then divides by N)? Quote:
EDIT: @all: I attached a small Excel app that computes the RPM jitter caused by the 6.525us timing resolution of the edge detections. There will be additional jitter due to manufacturing tolerances in the physical locations of the edges in the sensor, but I've not included those here. Note how large the jitter is with a 360 PPR sensor at 5000 RPM with averaging set to 1. If you set the averaging to 120 (1/3 revolution) you can reduce the jitter dramatically, at the cost of some phase lag in the signal. If you make a 1 PPR sensor with averaging set to 1 you'll be able to get an updated reading every 12ms at 5000 RPM with very low jitter. Last edited by Ether : 29-01-2013 at 14:53. Reason: revising jitter computation to better model quantization |
|
#24
|
|||
|
|||
|
Re: Best way to measure period between pulses? Counters and FPGA
Quote:
The I/O is 6.525 us from sample to sample. The timer used has a 1 us resolution. So the actual resolution is 6..7 us. However, the error is not cumulative across the average. Regardless of the number of samples averaged, the error is less than 7.525 us. Quote:
Cheers, -Joe |
|
#25
|
|||||
|
|||||
|
Re: Best way to measure period between pulses? Counters and FPGA
Quote:
Our 2012 robot (with a 4-line handmade aluminum and gaffers tape disc) averaged 12 samples (three whole rotations) to get a perfect signal with ~2.5rpm minimum step. If I set the graph to autosize I could see the controller oscillate between exactly one step above or below the target speed, when steady state. |
|
#26
|
||||
|
||||
|
Re: Best way to measure period between pulses? Counters and FPGA
Quote:
It's not in the 2012 C++ WPILib source rev3111 timer.cpp |
|
#27
|
|||
|
|||
|
Re: Best way to measure period between pulses? Counters and FPGA
Encoder.cpp and Counter.cpp
|
|
#28
|
||||
|
||||
|
Re: Best way to measure period between pulses? Counters and FPGA
OK, so we're talking about modifying and re-compiling the WPILib source, not simply passing a parameter?
|
|
#29
|
|||
|
|||
|
Re: Best way to measure period between pulses? Counters and FPGA
Quote:
Quote:
Cheers, -Joe |
|
#30
|
||||
|
||||
|
Re: Best way to measure period between pulses? Counters and FPGA
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|