Sandbox
From Team1370
(Difference between revisions)
(→Math for throttling) |
|||
Line 30: | Line 30: | ||
''Stick stuff here'' | ''Stick stuff here'' | ||
+ | <pre> | ||
if (Joystick = 255) | if (Joystick = 255) | ||
Joystick = 254; | Joystick = 254; | ||
Line 36: | Line 37: | ||
pwm = ((Joystick - 127) * (Throttle) / 254) + 127; | pwm = ((Joystick - 127) * (Throttle) / 254) + 127; | ||
- | + | </pre> | |
The (Joystick - 127) means that the joystick value shifted so that it goes from -127 to 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 +127 at the end shifts the system back up to the 0 to 254 range. |
Revision as of 00:39, 12 February 2006
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.