Thread: Drive Equations
View Single Post
  #9   Spotlight this post!  
Unread 15-02-2006, 16:31
slade24 slade24 is offline
AKA: Slick Daddy Ellis
AKA: Aaron Schultz
FRC #1370 (Blue Charge)
 
Join Date: Feb 2006
Rookie Year: 2004
Location: Middletown, DE
Posts: 6
slade24 is on a distinguished road
Re: Drive Equations

Though we haven't decided yet which one we want to use on our robot, we have three possible equations for throttling/sensitivity. (This is on a tank-drive system)

First I include this code:
if (Joystick >= 255)
Joystick = 254;
if (Throttle >= 255)
Throttle = 254;

Then I use one of these three equations (these are the pseudocode versions):
1) pwm = ((Joystick - 127) * (Throttle) / 254) + 127

2) pwm = ((Joystick-127)^3 / 16129) + 127

3) pwm = (cuberoot{Joystick-127} * 16129) + 127


In the first one, a joystick with a throttle on it (like the CH Flightstick Pro I have) can be used to adjust the maximum speed in both directions. When the throttle is at zero, the robot can't move, and when it is at full, the joysticks act normally. At a throttle of 127 (halfway), the joystick can go from 63.5 to 190.5. Besides simply reducing the maximum speeds, this approach also decreases sensitivity when the speed it lower (in other words, you can move more precisely). NOTE: the one throttle controls speed for both tank-drive joysticks.

In the second formula, the equation forms an exponential graph that gets sharper as it moves away from 127. This equation means that the robot will move slowly at first, but gain speed faster and faster.

In the third formula, for which I still have to figure out the coding, the graph is the inverse of that in #2. Speed gains very quickly at first, then more and more slowly.

NOTE: each of these formulas, when in the code, will be included inside a Limit_Mix call in order to prevent exceeding the 0-254 range.
__________________
-- Time is my only enemy --

Middletown Robotics: Home