Quote:
Originally Posted by Matt_4505
Code:
public class DriveControl {
double leftJoystickValue = 0;
double rightJoystickValue = 0;
/**
* Controls the Joystick Read-in.
* Reads the joystick values and directs values to the motors.
*/
public void driveRobot() {
if(Math.abs(Hardware.leftJoystick.getY()) > .25){
leftJoystickValue = Hardware.leftJoystick.getY();
}
if(Math.abs(Hardware.rightJoystick.getY()) > .25){
rightJoystickValue = Hardware.rightJoystick.getY();
}
|
This code will make the speed controllers run at about 0.25 when the joystick ramps down.
Imagine the following scenario
Code:
joystick output
1 1
0.75 0.75
0.5 0.5
0.3 0.3
0.26 0.26
0.25 0.25
0.1 0.25
0.0 0.25
You need to explicitly set the value back to 0 when it is <= 0.25. The initialize to 0 at the top only occurs once.