View Single Post
  #1   Spotlight this post!  
Unread 14-11-2013, 09:53
Matt_4505 Matt_4505 is offline
Registered User
FRC #4505
Team Role: Programmer
 
Join Date: Nov 2012
Rookie Year: 2012
Location: United States
Posts: 16
Matt_4505 is on a distinguished road
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
Reply With Quote