Sandbox

From Team1370

Revision as of 01:20, 12 February 2006 by Slade24 (Talk | contribs)

A workspace for temporary things


Contents

Joystick Config

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

Motion

  • Forward and backward motion will be achieved by cycling Joystick 1 and Joystick 2 forwards and 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

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.

Exponential Output

  • I reccomend using exponential output for controlling acceleration. In this situation, every joystick value x is given a value of (1/(127X^2)) + 127 to get y (or something similar). This particular equation will make it so that the robot quickly speeds up but accelerates more slowly as x increases.


Math for throttling

Stick stuff here

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

pwm = ((Joystick - 127) * (Throttle) / 254) + 127;
  • The (Joystick - 127) means that the joystick value 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. 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