so the problem is that since our robot is a 4-wheel drive, it travels pretty fast. To control the robot we are using a gamepad and the code is written so it is a tank drive. So we use the 2 joysticks on the gamepad to control each side of the robot.
And the problem is that if we just tap the joystick the robot goes flying, so we were thinking of limiting the speed to only 50%, so when the joystick is pushed fully the robot will only travels half speed.
Our standard tank drive regular runs at 50% max speed with a turbo button that boosts it to 100%.
Basically you multiply the joystick output by a constant to send a range of -0.5 to 0.5 to the motor controller. When the turbo button is pressed you double the value. If then statements would work.
My programmer hates it when I look over his shoulder, but I probably could get the code snippets if you want.
The joystick value ranges from -1 to 1.
Multiply the joystick value by the percentage of power that you want.
e.g., .5 for 50% or .25 for 25% or .75 for 75% power
So, a joystick value of -1 (full forward) * .75 = -.75 (or 75% of full power)
Using this method will cost power on the turns as well as the straightaways though, and depending on your wheelbase/wheel stickyness/ground surface may make turning difficult.
A better answer is to change the sprocket ratio driving the wheels. Increase the sprocket sizes on the wheels to lower your speed and increase turning torque.