Quote:
Originally Posted by BigJ
Can you elaborate more by what you mean by this:
To me that sounds like you're trying to set a deadzone, but I'm not sure.
|
Yep, that code is to set a deadzone, although since I have to keep increasing it's size, I'm losing a lot of mobility.
It might be an issue with zeroing the motor controllers, although, it works fine with Labview.
Heres the 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();
}
SmartDashboard.putNumber("leftJoystickValue", leftJoystickValue);
SmartDashboard.putNumber("righttJoystickValue", rightJoystickValue);
//decrease values by 3/4 for each trigger pressed
if (Hardware.leftJoystick.getRawButton(1)) {
leftJoystickValue = leftJoystickValue * (.75);
rightJoystickValue = leftJoystickValue * (.75);
}
SmartDashboard.putBoolean("leftJoystickTrigger Pressed", Hardware.leftJoystick.getRawButton(1));
//reduces values even more
if (Hardware.rightJoystick.getRawButton(1)) {
leftJoystickValue = leftJoystickValue * (.75);
rightJoystickValue = leftJoystickValue * (.75);
}
SmartDashboard.putBoolean("rigbhtJoystickTrigger Pressed", Hardware.rightJoystick.getRawButton(1)); //sends signal to bot with the adjusted drive values
Hardware.chassis.tankDrive(leftJoystickValue, rightJoystickValue);
}