View Single Post
  #14   Spotlight this post!  
Unread 19-03-2008, 14:29
Ziaholic's Avatar
Ziaholic Ziaholic is offline
Elec/SW Mentor
AKA: Marc
FRC #1164 (Project NEO)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2002
Location: Las Cruces, NM
Posts: 194
Ziaholic is a jewel in the roughZiaholic is a jewel in the roughZiaholic is a jewel in the roughZiaholic is a jewel in the rough
Re: Potentiometer arm control

Quote:
Originally Posted by jgannon View Post
Can you explain how that would work? I'm reasonably confident that you would get exactly the same result for any given value of arm_pos (discounting any overflow issues).
They're just trying to maximize the value in the numerator, prior to doing the division, which will truncate the decimals back to an integer. The larger the numerator, the less of a truncation error.

Using ArmPosition = 501, here's what you'd get with all 3 methods:

First Method:
wrist_pos = -11/5*arm_pos + 1670 = (-2)*501+1670 = 668

2nd method:
wrist_pos = -11*arm_pos/5 + 1670 = (-5511)/5 + 1670 = -1102+1670=568

3rd method:
wrist_pos = (-11*arm_pos + 1670*5 )/ 5 = 2850/5 = 567.8 = 567
__________________
----
There are 10 types of people. Those who understand binary, and those that do not.
Team #1164 - Project NEO Robotics