changed buttons and added half speed

This commit is contained in:
Adam Long 2016-09-22 21:40:43 +00:00
parent 5aa7e83bfa
commit 77bd25c69d
4 changed files with 17 additions and 11 deletions

View File

@ -34,18 +34,18 @@ public class OI {
}
// Print log when button 1 pressed
//joystickButtons[0][0].whenPressed(new LogEncoder());
joystickButtons[0][0].whileHeld(new SpinRollers(1));
joystickButtons[0][1].whileHeld(new SetShooterState(true));
joystickButtons[0][3].whileHeld(new SpinRollers(1));
// joystickButtons[0][2].whileHeld(new PIDDrive(400));
joystickButtons[1][0].whileHeld(new MoveArm(0.5));
joystickButtons[1][1].whileHeld(new MoveArm(-0.5));
joystickButtons[1][0].whileHeld(new MoveArm(1));
joystickButtons[1][1].whileHeld(new MoveArm(-1));
joystickButtons[1][2].whileHeld(new SetArmPosition(RobotMap.mainArmPresetCollect));
joystickButtons[1][3].whileHeld(new SetArmPosition(RobotMap.mainArmPresetTraverse));
joystickButtons[1][4].whileHeld(new SetArmPosition(RobotMap.mainArmPresetCloseShot));
joystickButtons[1][5].whileHeld(new SetArmPosition(RobotMap.mainArmPresetFarShot));
joystickButtons[1][7].whileHeld(new SetArmStopState(true));
joystickButtons[1][10].whileHeld(new ResetLower(-1));
joystickButtons[1][11].whileHeld(new ResetUpper(1));
// joystickButtons[1][10].whileHeld(new ResetLower(-1));
// joystickButtons[1][11].whileHeld(new ResetUpper(1));
}
public Joystick[] getJoysticks() {
return joysticks;

View File

@ -26,7 +26,7 @@ public class AutoSetArmPosition extends CommandBase {
// Stop when either limit switch is hit
System.out.println("AutoSetArmPosition.isFinished(): " + (Math.abs(pos - mainArm.getDegrees()) <= 1));
System.out.println(" pos : " + pos);
System.out.println(" mainArm.getDegrees() : " + mainArm.getDegrees())
System.out.println(" mainArm.getDegrees() : " + mainArm.getDegrees());
return Math.abs(pos - mainArm.getDegrees()) <= 1;
}
// Called once after isFinished returns true

View File

@ -5,6 +5,7 @@ import org.usfirst.frc.team2059.robot.Robot;
*
*/
public class Drive extends CommandBase {
double sensitivity = 0.5;
public Drive() {
requires(driveBase);
}
@ -16,7 +17,12 @@ public class Drive extends CommandBase {
double x = Robot.oi.getJoysticks()[0].getRawAxis(0);
double y = Robot.oi.getJoysticks()[0].getRawAxis(1);
double z = Robot.oi.getJoysticks()[0].getRawAxis(2);
driveBase.driveArcade(x, y, z, 0);
if(Robot.oi.getJoysticks()[0].getRawButton(1)){
sensitivity = 1;
}else{
sensitivity = 0.5;
}
driveBase.driveArcade(x, y, z, sensitivity);
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {

View File

@ -23,10 +23,10 @@ public class DriveBase extends Subsystem {
rightMotorTwo.set(0);
}
public void driveArcade(double x, double y, double z, double sensitivity) {
leftMotorOne.set(-y + (x + z));
leftMotorTwo.set(-y + (x + z));
rightMotorOne.set(y + (x + z));
rightMotorTwo.set(y + (x + z));
leftMotorOne.set((-y + (x + z))*sensitivity);
leftMotorTwo.set((-y + (x + z))*sensitivity);
rightMotorOne.set((y + (x + z))*sensitivity);
rightMotorTwo.set((y + (x + z))*sensitivity);
}
public void pidDrive(double setpoint) {
leftEncoder.reset();