Sandbox

From Team1370

(Difference between revisions)
(Exponential Output)
(Exponential Output)
 
Line 25: Line 25:
By using an exponential equation, the output may be ramped.   
By using an exponential equation, the output may be ramped.   
-
*By using <m> (root{3}{x-127} * 16129) + 127 </m>, as the joystick is pressed forward or backward, speed gains very quickly at first, then increases at a slowing rate.
+
*By using <!-- <m> (root{3}{x-127} * 16129) + 127 </m> --> cuberoot(x-127) * 16129 + 127, as the joystick is pressed forward or backward, speed gains very quickly at first, then increases at a slowing rate.
-
*To get the robot to go slowly at first, then faster and faster, try <m> ((x-127)^3 / 16129) + 127 </m>
+
*To get the robot to go slowly at first, then faster and faster, try <!-- <m> ((x-127)^3 / 16129) + 127 </m> --> ((x-127)^3 / 16129) + 127
''Notice that 16129 is 254<sup>2</sup> / 4''
''Notice that 16129 is 254<sup>2</sup> / 4''

Current revision as of 21:43, 4 January 2007

A workspace for temporary things


Contents

[edit] Joystick Config

  • Control values will range from 0 to 254.
  • Each value corresponds to a specific motor speed on the robot. 127 is neutral, <127 is reverse, >127 is forward.

[edit] Motion

  • Forward and backward motion will be achieved by cycling Joystick 1 and Joystick 2 forwards or backwards at the same time
  • Turning will be achieved using a track configuration. Moving Joystick 1 forward at a higher rate than Joystick 2 will result in a left turn, and vice versa for right. Moving left forwards equal to right backwards will result in a 360 degree left turn and vice versa for right.
  • The throttle will change the thrust multiplyer and/or additive.

Sensitivity

  • Joystick sensitivity is a problem, but there are a few solutions

[edit] Linear Output

  • We currently operate on linear output, where every joystick value x corresponds to motor value reception y plus or minus throttle setting z.
  • Throttle can count as a speed shifter. If we have max and min output value limiting functions, we can shift the throttle to achieve a higher max forward speed and a lower max reverse speed and vice versa if necessary on the fly.

[edit] Exponential Output

By using an exponential equation, the output may be ramped.

  • By using cuberoot(x-127) * 16129 + 127, as the joystick is pressed forward or backward, speed gains very quickly at first, then increases at a slowing rate.
  • To get the robot to go slowly at first, then faster and faster, try ((x-127)^3 / 16129) + 127

Notice that 16129 is 2542 / 4

[edit] Math for throttling

Stick stuff here

/***** Pseudo-code for throttling *****/

if (Joystick >= 255)
   Joystick = 254;
if (Throttle >= 255)
   Throttle = 254;

pwm = ((Joystick - 127) * (Throttle) / 254) + 127;
  • The (Joystick - 127) means that the joystick value is shifted so that it goes from -127 to 127.
  • The +127 at the end shifts the system back up to the 0 to 254 range.
  • The limit_mix function could be added in to prevent the pwm from recieving a number outside of 0-255 (although I don't see how that could happen).

The above code allows for a centered joystick to always leave the robot sitting still. When the throttle is at full, the joysticks work normally. When the throttle is at 0, the joystick range is cut from 0-254 all the way to just 127 (thus there is no movement). 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). Here is the chart:


Joystick = x-axis :: Throttle = y-axis
254 127 0
254 254 127 0
127 190.5 127 63.5
0 127 127 127
Personal tools