Quote:
Originally Posted by AmoryG
Part of training drivers is giving them multiple options to steer the bot. We programmed our controller so if you hit a button, it switches between different drive modes. This made it so anyone could practice any mode they wanted to just by hitting a button, not by reprogramming the robot.
|
That was one of the things I did with our programming team pre-season. Our drivebase software for the past few years uses a "speed" and "turn" value, mixing them to derive the motor control PWM outputs. The values are traditionally derived from tank-style joystick input, with speed being the average of the sticks' y-axes and turn being the difference. I showed them how to derive them instead from a single joystick, driving in arcade mode. Then we split the direct speed and turn inputs to get them from different joysticks, driving like an RC airplane with separate throttle and rudder.
I preferred the airplane mode. Everyone else liked tank mode best.
Quote:
I eventually discovered a cool way of doing this based on this...
On the joystick y-axis would run from bottom to top where bottom is 0 and top is 255. On the joystick x-axis would run from left to right where left is 0 and right is 255.
leftMotors = -127 + (y-axis + x-axis)
rightMotors = -127 + (y-axis + oposite of the x-axis (x-axis mirrored))
oposite of the x-axis means that if on the x axis it were really 255, it would count as 0 in the code.
|
That "cool way" is exactly what the default code does for single-joystick control. Take a look at its use of the LimitMix() function.