|
Keeping track of Encoder Shaft Location using WPI Counter VI
My team is using a Light Sensor with tape on shaft as Encoder to keep track of the extension arm position. We are using Lab View. To keep track of Count (every revolution reflective tape passes light sensor) I am using the WPI Counter VI. After testing, it is not as accurate as I would hope... may have to live with it since this is what I was given and they can not change it now. I believe it is the mechanical binding that is the problem, not sensor bandwidth.
The counter will only increment in either direction. When one button pressed extension arm extends, other button, reverse motor and retracts. I am not sure why, but I can not keep proper count in reverse direction. I am using a shift register, add count in forward (check if forward button pressed), subtract count in reverse (check if reverse button pressed). I set while loop stop to True, so executes once, having shift register return previous count and compare new count. I am not sure why it is not working, timing issue with counter & while loop/shift register? If no button pressed, I pass shift register previous straight thru. I tried other ways than shift register, appears to be similar problem. This seems like a simple thing to do, but is not working. I would appreciate any support or new ideals. I can only attach retract (subtract counter) portion of code do to file size. Thanx... Appreciate help, in theory code should be simple, something else must be wrong
|