From 77bd25c69d7cb208901280991a662f86d2310b0d Mon Sep 17 00:00:00 2001 From: Adam Long Date: Thu, 22 Sep 2016 21:40:43 +0000 Subject: [PATCH] changed buttons and added half speed --- src/org/usfirst/frc/team2059/robot/OI.java | 10 +++++----- .../robot/commands/autonomous/AutoSetArmPosition.java | 2 +- .../frc/team2059/robot/commands/drivetrain/Drive.java | 8 +++++++- .../frc/team2059/robot/subsystems/DriveBase.java | 8 ++++---- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/org/usfirst/frc/team2059/robot/OI.java b/src/org/usfirst/frc/team2059/robot/OI.java index d875e9d..2fd1abf 100644 --- a/src/org/usfirst/frc/team2059/robot/OI.java +++ b/src/org/usfirst/frc/team2059/robot/OI.java @@ -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; diff --git a/src/org/usfirst/frc/team2059/robot/commands/autonomous/AutoSetArmPosition.java b/src/org/usfirst/frc/team2059/robot/commands/autonomous/AutoSetArmPosition.java index 628bc79..315f4d4 100644 --- a/src/org/usfirst/frc/team2059/robot/commands/autonomous/AutoSetArmPosition.java +++ b/src/org/usfirst/frc/team2059/robot/commands/autonomous/AutoSetArmPosition.java @@ -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 diff --git a/src/org/usfirst/frc/team2059/robot/commands/drivetrain/Drive.java b/src/org/usfirst/frc/team2059/robot/commands/drivetrain/Drive.java index e17f742..b95696d 100644 --- a/src/org/usfirst/frc/team2059/robot/commands/drivetrain/Drive.java +++ b/src/org/usfirst/frc/team2059/robot/commands/drivetrain/Drive.java @@ -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() { diff --git a/src/org/usfirst/frc/team2059/robot/subsystems/DriveBase.java b/src/org/usfirst/frc/team2059/robot/subsystems/DriveBase.java index 616ee83..b03775d 100644 --- a/src/org/usfirst/frc/team2059/robot/subsystems/DriveBase.java +++ b/src/org/usfirst/frc/team2059/robot/subsystems/DriveBase.java @@ -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();