View Single Post
  #15   Spotlight this post!  
Unread 26-08-2013, 15:30
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,795
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: encoder values fluctuating considerably

Quote:
Originally Posted by grosh View Post
Now can someone help me determine the correct value to use for DistancePerCount in the Encoder Open VI?
It depends on what you want Get Distance to return.
In the example code you are using it isn't actually setup to return distance. It is setup to return an angle of rotation. In normal usage I'd prefer the Get Distance to return actual inches travelled.

If you want to use the example code as is and keep Distance as a rotation angle, then you can determine the value experimentally by setting DistancePerCount to 1, rotating the wheel 360 degrees (or some multiple to help reduce error), finally dividing 360 by the "Distance" to get DistancePerCount in degrees/count. You'll need to add a display of the raw Distance value, so you can use it. The value can also be calculated analytically as long as you take into account any reduction, so you know what a full rotation is.

If instead you want to have the Get return actual distance travelled, then follow the (paraphrased) example given by the LV Help detail for Encoder Open:
"For example, if the wheel diameter is six inches and the encoder pulses 360 times per rotation of the wheel (at 1x), then a scaling factor of 6*pi / 360= .0524 returns the number of inches the wheel has turned. In this case, you input .0524 ."

I also recommend experimentally verifying the distance value by setting DistancePerCount=1 (that'll output the number of ticks as the "Distance"), adding a display of the raw Distance value, then slowly push your robot a pre-measured distance using a tape measure. That'll give you the proper value to use by dividing the measured distance by the Get Distance.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 27-08-2013 at 09:52.
Reply With Quote