|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Tank Drive Issues
Hello,
This year I have been switching my team over to Java and we have started to work with a Command Based control system. I built my drivetrain in RobotBuilder and then added code for the Tank Drive. Unfortunately, when I try to run the code, the left Joystick controls both sides of the robot instead of just the left side. The Code: DriveTrain subsystem: public void tankDrive(double leftJoystickValue, double rightJoystickValue){ robotDrive.tankDrive(leftJoystickValue, rightJoystickValue); } public double deadZone (double val) { return val > 0.25 || val < -0.25? val: 0; } public double adjustSpeed (double val){ return Robot.oi.leftJoystick.getRawButton(1)? val*.75: (Robot.oi.rightJoystick.getRawButton(1)? val*.75: val); } DriveCommand: protected void execute() { Robot.drivetrain.tankDrive(Robot.drivetrain.adjust Speed(Robot.drivetrain.deadZone(Robot.oi.getleftJo ystick().getY())), Robot.drivetrain.adjustSpeed(Robot.drivetrain.dead Zone(Robot.oi.getrightJoystick().getY()))); } Thanks |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|