fix conflicts
authorDavid <david.dobervich@gmail.com>
Fri, 20 Nov 2015 16:07:34 +0000 (08:07 -0800)
committerDavid <david.dobervich@gmail.com>
Fri, 20 Nov 2015 16:07:34 +0000 (08:07 -0800)
17 files changed:
.classpath [deleted file]
.gitignore
.project [deleted file]
src/org/usfirst/frc3501/RiceCatRobot/commands/CloseClaw.java
src/org/usfirst/frc3501/RiceCatRobot/commands/DriveFor.java
src/org/usfirst/frc3501/RiceCatRobot/commands/DriveForTime.java [new file with mode: 0644]
src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmFor.java
src/org/usfirst/frc3501/RiceCatRobot/commands/OpenClaw.java
src/org/usfirst/frc3501/RiceCatRobot/commands/ToggleClaw.java
src/org/usfirst/frc3501/RiceCatRobot/commands/ToggleCompressor.java
src/org/usfirst/frc3501/RiceCatRobot/commands/TurnFor.java
src/org/usfirst/frc3501/RiceCatRobot/robot/OI.java
src/org/usfirst/frc3501/RiceCatRobot/robot/Robot.java
src/org/usfirst/frc3501/RiceCatRobot/robot/RobotMap.java
src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java
src/org/usfirst/frc3501/RiceCatRobot/subsystems/Claw.java
src/org/usfirst/frc3501/RiceCatRobot/subsystems/DriveTrain.java

diff --git a/.classpath b/.classpath
deleted file mode 100644 (file)
index 10a431f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="src" path="src"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-       <classpathentry kind="lib" path="/home/cindy/wpilib/java/current/lib/NetworkTables.jar"/>
-       <classpathentry kind="lib" path="/home/cindy/wpilib/java/current/lib/WPILib.jar"/>
-       <classpathentry kind="output" path="bin"/>
-</classpath>
index 227a01040b143d348eaaaddfe59f53c2c2213ec1..7a58fe3c2db27e307ab487fba75f910d2ce3bf69 100644 (file)
@@ -1,3 +1,10 @@
+<<<<<<< HEAD
+# -*- mode: gitignore; -*-
+*~
+\#*\#
+.\#*
+=======
+>>>>>>> fb376f02820fc8dd8404759e2b45fa582969dc3e
 *.pydevproject
 .metadata
 .gradle
@@ -39,4 +46,8 @@ local.properties
 .texlipse
 
 # STS (Spring Tool Suite)
-.springBeans
\ No newline at end of file
+<<<<<<< HEAD
+.springBeans
+=======
+.springBeans
+>>>>>>> fb376f02820fc8dd8404759e2b45fa582969dc3e
diff --git a/.project b/.project
deleted file mode 100644 (file)
index f42f1b9..0000000
--- a/.project
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>2015-FRC-Spark</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-               <buildCommand>
-                       <name>org.eclipse.jdt.core.javabuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>org.eclipse.jdt.core.javanature</nature>
-               <nature>edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature</nature>
-       </natures>
-</projectDescription>
index 66cf89bad0600d260c4a3be20b3c231458f53b9f..f26f6c3730ae0e1b158d28a65963217b70d700dc 100644 (file)
@@ -9,28 +9,28 @@ import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
  */
 public class CloseClaw extends Command {
 
-    public CloseClaw() {
-        requires(Robot.claw);
-    }
+  public CloseClaw() {
+    requires(Robot.claw);
+  }
 
-    protected void initialize() {
-        System.out.println("IN INIT CLOSECLAW");
-    }
+  protected void initialize() {
+    System.out.println("IN INIT CLOSECLAW");
+  }
 
-    protected void execute() {
-        Robot.claw.closeClaw();
-        System.out.println("Closing claw");
-    }
+  protected void execute() {
+    Robot.claw.closeClaw();
+    System.out.println("Closing claw");
+  }
 
-    protected boolean isFinished() {
-        System.out.println("Claw Closed");
-        return !Robot.claw.isOpen();
-    }
+  protected boolean isFinished() {
+    System.out.println("Claw Closed");
+    return !Robot.claw.isOpen();
+  }
 
-    protected void end() {
+  protected void end() {
 
-    }
+  }
 
-    protected void interrupted() {
-    }
+  protected void interrupted() {
+  }
 }
index bbc3dfa95052b13dbedc740dca188980a7c4a6cf..ee6fe267ab51965b3174fe553d43608beda6c8fc 100644 (file)
@@ -11,66 +11,62 @@ import edu.wpi.first.wpilibj.command.Command;
  *
  */
 public class DriveFor extends Command {
-    private double seconds;
-    private Timer timer;
-    private Direction direction;
+  private double seconds;
+  private Timer timer;
+  private Direction direction;
 
-    public DriveFor(double seconds, Direction direction) {
-        this.seconds = seconds;
-        this.direction = direction;
+  public DriveFor(double seconds, Direction direction) {
+    this.seconds = seconds;
+    this.direction = direction;
 
-    }
+  }
 
-    @Override
-    protected void initialize() {
-        timer = new Timer();
-        timer.reset();
-        timer.start();
-    }
+  @Override
+  protected void initialize() {
+    timer = new Timer();
+    timer.reset();
+    timer.start();
+  }
 
-    @Override
-    protected void execute() {
-        System.out.println(timer.get());
-        if (direction == Direction.FORWARD) {
-            if (timer.get() < seconds * 0.2) { // for the first 20% of time, run
-                                               // the robot at -.5 speed
-                Robot.driveTrain.arcadeDrive(-0.3, 0);
-            } else if (timer.get() >= seconds * 0.2
-                    && timer.get() <= seconds * 0.8) { // for the +20% - 75%
-                                                       // time, move the robot
-                                                       // at -.3 speed.
-                Robot.driveTrain.arcadeDrive(-0.5, 0);
-            } else if (timer.get() < seconds) {
-                Robot.driveTrain.arcadeDrive(-0.25, 0);
-            } else {
-                Robot.driveTrain.arcadeDrive(0, 0);
-            }
-        } else if (direction == Direction.BACKWARD) {
-            if (timer.get() < seconds * 0.2) {
-                Robot.driveTrain.arcadeDrive(0.3, 0);
-            } else if (timer.get() >= seconds * 0.2
-                    && timer.get() <= seconds * 0.8) {
-                Robot.driveTrain.arcadeDrive(0.5, 0);
-            } else if (timer.get() < seconds) {
-                Robot.driveTrain.arcadeDrive(0.25, 0);
-            } else {
-                Robot.driveTrain.arcadeDrive(0, 0);
-            }
-        }
+  @Override
+  protected void execute() {
+    System.out.println(timer.get());
+    if (direction == Direction.FORWARD) {
+      if (timer.get() < seconds * 0.2) { // for the first 20% of time, run
+                                         // the robot at -.5 speed
+        Robot.driveTrain.arcadeDrive(-0.3, 0);
+      } else if (timer.get() >= seconds * 0.2 && timer.get() <= seconds * 0.8) {
+        Robot.driveTrain.arcadeDrive(-0.5, 0);
+      } else if (timer.get() < seconds) {
+        Robot.driveTrain.arcadeDrive(-0.25, 0);
+      } else {
+        Robot.driveTrain.arcadeDrive(0, 0);
+      }
+    } else if (direction == Direction.BACKWARD) {
+      if (timer.get() < seconds * 0.2) {
+        Robot.driveTrain.arcadeDrive(0.3, 0);
+      } else if (timer.get() >= seconds * 0.2 && timer.get() <= seconds * 0.8) {
+        Robot.driveTrain.arcadeDrive(0.5, 0);
+      } else if (timer.get() < seconds) {
+        Robot.driveTrain.arcadeDrive(0.25, 0);
+      } else {
+        Robot.driveTrain.arcadeDrive(0, 0);
+      }
     }
+  }
 
-    @Override
-    protected boolean isFinished() {
-        return timer.get() > seconds;
-    }
+  @Override
+  protected boolean isFinished() {
+    return timer.get() > seconds;
+  }
 
-    @Override
-    protected void end() {
-        Robot.driveTrain.arcadeDrive(0, 0);
-    }
+  @Override
+  protected void end() {
+    Robot.driveTrain.arcadeDrive(0, 0);
+  }
 
-    @Override
-    protected void interrupted() {
-        end();
-    }
+  @Override
+  protected void interrupted() {
+    end();
+  }
 }
diff --git a/src/org/usfirst/frc3501/RiceCatRobot/commands/DriveForTime.java b/src/org/usfirst/frc3501/RiceCatRobot/commands/DriveForTime.java
new file mode 100644 (file)
index 0000000..f662e4b
--- /dev/null
@@ -0,0 +1,59 @@
+package org.usfirst.frc3501.RiceCatRobot.commands;
+
+import org.usfirst.frc3501.RiceCatRobot.Robot;
+import org.usfirst.frc3501.RiceCatRobot.RobotMap.Direction;
+
+import edu.wpi.first.wpilibj.Timer;
+import edu.wpi.first.wpilibj.command.Command;
+
+/**
+ * This command takes a time in seconds which is how long it should run
+ *
+ */
+public class DriveForTime extends Command {
+  private double seconds;
+  private Timer timer;
+  private double speed;
+
+  /***
+   * Drive at a fixed speed (speed) for a fixed time (seconds).
+   *
+   * @param seconds
+   *          the number of seconds to drive
+   * @param speed
+   *          a motor value in the range [-1, 1]. Negative numbers are
+   *          interpreted as driving backwards. 0 is stopped.
+   */
+  public DriveForTime(double seconds, double speed) {
+    this.seconds = seconds;
+    this.speed = -speed; // note: setMotorSpeeds(-1, -1) would be
+    // forward full speed, so we take the opposite
+    // of the input to achieve this.
+  }
+
+  @Override
+  protected void initialize() {
+    this.setTimeout(seconds);
+    Robot.driveTrain.setMotorSpeeds(speed, speed);
+  }
+
+  @Override
+  protected void execute() {
+    // nothing here because motors are already set
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return this.isTimedOut();
+  }
+
+  @Override
+  protected void end() {
+    Robot.driveTrain.stop();
+  }
+
+  @Override
+  protected void interrupted() {
+    end();
+  }
+}
index 0600b1dcf73b3841ca1f8c93952732d6970bbde3..8cdbec2c542bd42f47e2850782ac57efb322658e 100644 (file)
@@ -13,48 +13,48 @@ import edu.wpi.first.wpilibj.command.Command;
  *
  */
 public class MoveArmFor extends Command {
-    private double seconds;
-    private Timer timer;
-    private Direction direction;
-
-    /*
-     * @param Direction must be up or down
-     */
-    public MoveArmFor(double seconds, Direction direction) {
-        this.seconds = seconds;
-        this.direction = direction;
+  private double seconds;
+  private Timer timer;
+  private Direction direction;
+
+  /*
+   * @param Direction must be up or down
+   */
+  public MoveArmFor(double seconds, Direction direction) {
+    this.seconds = seconds;
+    this.direction = direction;
+  }
+
+  @Override
+  protected void initialize() {
+    timer = new Timer();
+    timer.start();
+  }
+
+  @Override
+  protected void execute() {
+    if (direction == Direction.UP) {
+      Robot.arm.setArmSpeeds(-RobotMap.ARM_LOW_SPEED);
+    } else if (direction == Direction.DOWN) {
+      Robot.arm.setArmSpeeds(RobotMap.ARM_LOW_SPEED);
     }
+  }
 
-    @Override
-    protected void initialize() {
-        timer = new Timer();
-        timer.start();
-    }
-
-    @Override
-    protected void execute() {
-        if (direction == Direction.UP) {
-            Robot.arm.setArmSpeeds(-RobotMap.ARM_LOW_SPEED);
-        } else if (direction == Direction.DOWN) {
-            Robot.arm.setArmSpeeds(RobotMap.ARM_LOW_SPEED);
-        }
-    }
-
-    @Override
-    protected boolean isFinished() {
-        if (timer.get() > seconds) {
-            Robot.arm.setArmSpeeds(0);
-        }
-        return timer.get() > seconds;
-    }
-
-    @Override
-    protected void end() {
-        Robot.arm.setArmSpeeds(0);
-    }
-
-    @Override
-    protected void interrupted() {
-        end();
+  @Override
+  protected boolean isFinished() {
+    if (timer.get() > seconds) {
+      Robot.arm.setArmSpeeds(0);
     }
+    return timer.get() > seconds;
+  }
+
+  @Override
+  protected void end() {
+    Robot.arm.setArmSpeeds(0);
+  }
+
+  @Override
+  protected void interrupted() {
+    end();
+  }
 }
index 320f4d0e9e56cbfc682589be0eec0c413432b84b..c0d351d425d563e45311208d7101df0f21cf4704 100644 (file)
@@ -10,28 +10,28 @@ import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
  */
 public class OpenClaw extends Command {
 
-    public OpenClaw() {
-        requires(Robot.claw);
-    }
+  public OpenClaw() {
+    requires(Robot.claw);
+  }
 
-    protected void initialize() {
-        System.out.println("IN INIT OPENCLAW");
-    }
+  protected void initialize() {
+    System.out.println("IN INIT OPENCLAW");
+  }
 
-    protected void execute() {
-        Robot.claw.openClaw();
-        System.out.println("Opening Claw");
-    }
+  protected void execute() {
+    Robot.claw.openClaw();
+    System.out.println("Opening Claw");
+  }
 
-    protected boolean isFinished() {
-        System.out.println("Claw Opened");
-        return Robot.claw.isOpen();
-    }
+  protected boolean isFinished() {
+    System.out.println("Claw Opened");
+    return Robot.claw.isOpen();
+  }
 
-    protected void end() {
+  protected void end() {
 
-    }
+  }
 
-    protected void interrupted() {
-    }
+  protected void interrupted() {
+  }
 }
index 720ec4197cc264f14eef7385e39c7e56a16cb3b4..c85ea77d46b5155a66628a2bc9eed17ca6be2aba 100644 (file)
@@ -9,28 +9,28 @@ import edu.wpi.first.wpilibj.command.Command;
  */
 public class ToggleClaw extends Command {
 
-    public ToggleClaw() {
+  public ToggleClaw() {
 
-    }
+  }
 
-    protected void initialize() {
-        Robot.claw.toggleOn = !Robot.claw.toggleOn;
-    }
+  protected void initialize() {
+    Robot.claw.toggleOn = !Robot.claw.toggleOn;
+  }
 
-    protected void execute() {
-        if (Robot.claw.toggleOn && Robot.claw.isOpen()) {
-            Robot.claw.closeClaw();
-        }
+  protected void execute() {
+    if (Robot.claw.toggleOn && Robot.claw.isOpen()) {
+      Robot.claw.closeClaw();
     }
+  }
 
-    protected boolean isFinished() {
-        return true;
-    }
+  protected boolean isFinished() {
+    return true;
+  }
 
-    protected void end() {
+  protected void end() {
 
-    }
+  }
 
-    protected void interrupted() {
-    }
+  protected void interrupted() {
+  }
 }
index eb413542defce1109b4f129fe79921cb2c3995fc..3669eaf88568d30fa87f176ec30ec53b13e071f4 100644 (file)
@@ -9,35 +9,35 @@ import edu.wpi.first.wpilibj.command.Command;
  */
 public class ToggleCompressor extends Command {
 
-    public ToggleCompressor() {
+  public ToggleCompressor() {
+  }
+
+  // Called just before this Command runs the first time
+  protected void initialize() {
+  }
+
+  // Called repeatedly when this Command is scheduled to run
+  protected void execute() {
+    if (Robot.compressor.enabled()) {
+      Robot.compressor.stop();
+    } else {
+      Robot.compressor.start();
     }
 
-    // Called just before this Command runs the first time
-    protected void initialize() {
-    }
-
-    // Called repeatedly when this Command is scheduled to run
-    protected void execute() {
-        if (Robot.compressor.enabled()) {
-            Robot.compressor.stop();
-        } else {
-            Robot.compressor.start();
-        }
+  }
 
-    }
+  // Make this return true when this Command no longer needs to run execute()
+  protected boolean isFinished() {
+    return true;
+  }
 
-    // Make this return true when this Command no longer needs to run execute()
-    protected boolean isFinished() {
-        return true;
-    }
+  // Called once after isFinished returns true
+  protected void end() {
 
-    // Called once after isFinished returns true
-    protected void end() {
+  }
 
-    }
-
-    // Called when another command which requires one or more of the same
-    // subsystems is scheduled to run
-    protected void interrupted() {
-    }
+  // Called when another command which requires one or more of the same
+  // subsystems is scheduled to run
+  protected void interrupted() {
+  }
 }
index cf716d45ab9e74cc9a28f3e93e10b48ae76b0eaa..580fe06875f3c8badf04684ac9b8fc4af48c4808 100644 (file)
@@ -7,48 +7,48 @@ import edu.wpi.first.wpilibj.Timer;
 import edu.wpi.first.wpilibj.command.Command;
 
 public class TurnFor extends Command {
-    private double seconds;
-    private Timer timer;
-    private Direction direction;
-
-    public TurnFor(double seconds, Direction direction) {
-        this.seconds = seconds;
-        this.direction = direction;
-    }
-
-    @Override
-    protected void initialize() {
-        timer = new Timer();
-        timer.start();
-    }
-
-    @Override
-    protected void execute() {
-        if (direction == Direction.LEFT) {
-            Robot.driveTrain.arcadeDrive(0, -0.5);
-        } else if (direction == Direction.RIGHT) {
-            Robot.driveTrain.arcadeDrive(0, 0.5);
-        } else {
-            Robot.driveTrain.arcadeDrive(0, 0);
-        }
+  private double seconds;
+  private Timer timer;
+  private Direction direction;
+
+  public TurnFor(double seconds, Direction direction) {
+    this.seconds = seconds;
+    this.direction = direction;
+  }
+
+  @Override
+  protected void initialize() {
+    timer = new Timer();
+    timer.start();
+  }
+
+  @Override
+  protected void execute() {
+    if (direction == Direction.LEFT) {
+      Robot.driveTrain.arcadeDrive(0, -0.5);
+    } else if (direction == Direction.RIGHT) {
+      Robot.driveTrain.arcadeDrive(0, 0.5);
+    } else {
+      Robot.driveTrain.arcadeDrive(0, 0);
     }
-
-    @Override
-    protected boolean isFinished() {
-        System.out.println(timer.get());
-        System.out.println(seconds);
-        if (timer.get() > seconds) {
-            Robot.driveTrain.arcadeDrive(0, 0);
-        }
-        return timer.get() > seconds;
+  }
+
+  @Override
+  protected boolean isFinished() {
+    System.out.println(timer.get());
+    System.out.println(seconds);
+    if (timer.get() > seconds) {
+      Robot.driveTrain.arcadeDrive(0, 0);
     }
+    return timer.get() > seconds;
+  }
 
-    @Override
-    protected void end() {
-    }
+  @Override
+  protected void end() {
+  }
 
-    @Override
-    protected void interrupted() {
-        end();
-    }
+  @Override
+  protected void interrupted() {
+    end();
+  }
 }
index 6bebe5445fcff4c3ac02fce576614f2f1a109c44..9c391da8b03d72748a7ae832f7e63c107121c63a 100644 (file)
@@ -7,25 +7,25 @@ import edu.wpi.first.wpilibj.Joystick;
 import edu.wpi.first.wpilibj.buttons.JoystickButton;
 
 public class OI {
-    public static Joystick leftJoystick;
-    public static Joystick rightJoystick;
-    public static JoystickButton trigger;
-    public static JoystickButton toggleCompressor;
-    public static JoystickButton toggleClaw;
+  public static Joystick leftJoystick;
+  public static Joystick rightJoystick;
+  public static JoystickButton trigger;
+  public static JoystickButton toggleCompressor;
+  public static JoystickButton toggleClaw;
 
-    public OI() {
-        System.out.println("OI is open");
-        leftJoystick = new Joystick(RobotMap.LEFT_STICK_PORT);
-        rightJoystick = new Joystick(RobotMap.RIGHT_STICK_PORT);
+  public OI() {
+    System.out.println("OI is open");
+    leftJoystick = new Joystick(RobotMap.LEFT_STICK_PORT);
+    rightJoystick = new Joystick(RobotMap.RIGHT_STICK_PORT);
 
-        trigger = new JoystickButton(rightJoystick, RobotMap.TRIGGER_PORT);
+    trigger = new JoystickButton(rightJoystick, RobotMap.TRIGGER_PORT);
 
-        toggleClaw = new JoystickButton(rightJoystick, RobotMap.TOGGLE_PORT);
-        toggleClaw.whenPressed(new ToggleClaw());
+    toggleClaw = new JoystickButton(rightJoystick, RobotMap.TOGGLE_PORT);
+    toggleClaw.whenPressed(new ToggleClaw());
 
-        toggleCompressor = new JoystickButton(rightJoystick,
-                RobotMap.TOGGLE_COMPRESSOR_PORT);
-        toggleCompressor.whenPressed(new ToggleCompressor());
+    toggleCompressor = new JoystickButton(rightJoystick,
+        RobotMap.TOGGLE_COMPRESSOR_PORT);
+    toggleCompressor.whenPressed(new ToggleCompressor());
 
-    }
+  }
 }
index 1191d0e17b00f393cd8a03caa7aeba51fe61d54c..e83f800531d8d2c901e41e88b4e8eac5caaac0f7 100644 (file)
@@ -10,60 +10,60 @@ import edu.wpi.first.wpilibj.Timer;
 import edu.wpi.first.wpilibj.command.Scheduler;
 
 public class Robot extends IterativeRobot {
-    static Timer timer;
-    public static OI oi;
-    public static DriveTrain driveTrain;
-    public static Arm arm;
-    public static Claw claw;
-    public static Compressor compressor;
+  static Timer timer;
+  public static OI oi;
+  public static DriveTrain driveTrain;
+  public static Arm arm;
+  public static Claw claw;
+  public static Compressor compressor;
 
-    public void robotInit() {
-        RobotMap.init();
-        driveTrain = new DriveTrain();
-        arm = new Arm();
-        claw = new Claw();
-        oi = new OI();
-        compressor = new Compressor(RobotMap.COMPRESSOR_PORT);
-    }
+  public void robotInit() {
+    RobotMap.init();
+    driveTrain = new DriveTrain();
+    arm = new Arm();
+    claw = new Claw();
+    oi = new OI();
+    compressor = new Compressor(RobotMap.COMPRESSOR_PORT);
+  }
 
-    public void autonomousInit() {
-    }
+  public void autonomousInit() {
+  }
 
-    public void autonomousPeriodic() {
-        Scheduler.getInstance().run();
-    }
+  public void autonomousPeriodic() {
+    Scheduler.getInstance().run();
+  }
 
-    public void teleopInit() {
-        System.out.println("running teleopInit");
-    }
+  public void teleopInit() {
+    System.out.println("running teleopInit");
+  }
 
-    public void teleopPeriodic() {
-        Scheduler.getInstance().run();
+  public void teleopPeriodic() {
+    Scheduler.getInstance().run();
 
-    }
+  }
 
-    public void operate() {
-        driveTrain.arcadeDrive(OI.rightJoystick.getY(),
-                OI.rightJoystick.getTwist());
-        claw.doTriggerAction();
-        if (OI.leftJoystick.getRawButton(8)) {
-            arm.setArmSpeeds(0.3);
-        } else if (OI.leftJoystick.getRawButton(9)) {
-            arm.setArmSpeeds(-0.3);
-        } else if (OI.leftJoystick.getRawButton(6)) {
-            arm.setLeft(0.3);
-        } else if (OI.leftJoystick.getRawButton(7)) {
-            arm.setLeft(-0.3);
-        } else if (OI.leftJoystick.getRawButton(11)) {
-            arm.setRight(-0.3);
-        } else if (OI.leftJoystick.getRawButton(10)) {
-            arm.setRight(0.3);
-        }
-        if (Math.abs(OI.leftJoystick.getY()) < 0.05) {
-            arm.setArmSpeeds(0);
+  public void operate() {
+    driveTrain
+        .arcadeDrive(OI.rightJoystick.getY(), OI.rightJoystick.getTwist());
+    claw.doTriggerAction();
+    if (OI.leftJoystick.getRawButton(8)) {
+      arm.setArmSpeeds(0.3);
+    } else if (OI.leftJoystick.getRawButton(9)) {
+      arm.setArmSpeeds(-0.3);
+    } else if (OI.leftJoystick.getRawButton(6)) {
+      arm.setLeft(0.3);
+    } else if (OI.leftJoystick.getRawButton(7)) {
+      arm.setLeft(-0.3);
+    } else if (OI.leftJoystick.getRawButton(11)) {
+      arm.setRight(-0.3);
+    } else if (OI.leftJoystick.getRawButton(10)) {
+      arm.setRight(0.3);
+    }
+    if (Math.abs(OI.leftJoystick.getY()) < 0.05) {
+      arm.setArmSpeeds(0);
 
-        } else {
-            arm.fineTuneControl(OI.leftJoystick.getY());
-        }
+    } else {
+      arm.fineTuneControl(OI.leftJoystick.getY());
     }
+  }
 }
index 95604c371f7a05dc6396ecd854a04d01fde2f6f5..90f10ec2d9ebe2e1f38afc8fce41ab8624e73a99 100644 (file)
@@ -10,32 +10,33 @@ import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
  * floating around.
  */
 public class RobotMap {
-    public final static int LEFT_STICK_PORT = 0, RIGHT_STICK_PORT = 1;
-    public final static int TRIGGER_PORT = 1, TOGGLE_PORT = 2,
-            TOGGLE_COMPRESSOR_PORT = 11;
-    public static final int DRIVE_FRONT_LEFT = 4, DRIVE_FRONT_RIGHT = 5,
-            DRIVE_REAR_LEFT = 3, DRIVE_REAR_RIGHT = 6;
-    public static final int DRIVE_LEFT_A = 3, DRIVE_LEFT_B = 4,
-            DRIVE_RIGHT_A = 2, DRIVE_RIGHT_B = 1;
+  public final static int LEFT_STICK_PORT = 0, RIGHT_STICK_PORT = 1;
+  public final static int TRIGGER_PORT = 1, TOGGLE_PORT = 2,
+      TOGGLE_COMPRESSOR_PORT = 11;
+  public static final int DRIVE_FRONT_LEFT = 4, DRIVE_FRONT_RIGHT = 5,
+      DRIVE_REAR_LEFT = 3, DRIVE_REAR_RIGHT = 6;
+  public static final int DRIVE_LEFT_A = 3, DRIVE_LEFT_B = 4,
+      DRIVE_RIGHT_A = 2, DRIVE_RIGHT_B = 1;
 
-    public static final double DISTANCE_PER_PULSE = ((3.66 / 5.14) * 6 * Math.PI) / 256;
+  public static final double DISTANCE_PER_PULSE =
+    ((3.66 / 5.14) * 6 * Math.PI) / 256;
 
-    public static final int ARM_LEFT = 2, ARM_RIGHT = 7;
-    public static final double ARM_HIGH_SPEED = 0.5, ARM_LOW_SPEED = 0.5;
+  public static final int ARM_LEFT = 2, ARM_RIGHT = 7;
+  public static final double ARM_HIGH_SPEED = 0.5, ARM_LOW_SPEED = 0.5;
 
-    // Claw
-    public static final int SOLENOID_FORWARD = 0, SOLENOID_REVERSE = 1,
-            MODULE_NUMBER = 0;
-    public final static Value open = DoubleSolenoid.Value.kForward,
-            close = DoubleSolenoid.Value.kReverse;
-    public static double DRIVE_DEAD_ZONE = 0.25;
-    // Compressor
-    public static final int COMPRESSOR_PORT = 0;
+  // Claw
+  public static final int SOLENOID_FORWARD = 0, SOLENOID_REVERSE = 1,
+      MODULE_NUMBER = 0;
+  public final static Value open = DoubleSolenoid.Value.kForward,
+      close = DoubleSolenoid.Value.kReverse;
+  public static double DRIVE_DEAD_ZONE = 0.25;
+  // Compressor
+  public static final int COMPRESSOR_PORT = 0;
 
-    public static void init() {
-    }
+  public static void init() {
+  }
 
-    public static enum Direction {
-        LEFT, RIGHT, DOWN, UP, FORWARD, BACKWARD;
-    }
+  public static enum Direction {
+    LEFT, RIGHT, DOWN, UP, FORWARD, BACKWARD;
+  }
 }
index be8cfa8c7ccec0e49c39ce15d97b68cf38cdc4d1..e20a822938fa2a66c26bd39bebfed9b74d3fb013 100644 (file)
@@ -6,42 +6,42 @@ import edu.wpi.first.wpilibj.CANJaguar;
 import edu.wpi.first.wpilibj.command.Subsystem;
 
 public class Arm extends Subsystem {
-    private CANJaguar left, right;
-
-    public Arm() {
-        left = new CANJaguar(RobotMap.ARM_LEFT);
-        right = new CANJaguar(RobotMap.ARM_RIGHT);
-    }
-
-    public void initDefaultCommand() {
-    }
-
-    public void fineTuneControl(double d) {
-        if (Math.abs(d) < 0.05) {
-            d = 0;
-        } else if (d > 0) {
-            d *= d;
-        } else {
-            d *= -d;
-        }
-        setArmSpeeds(d);
-    }
-
-    public void setLeft(double speed) {
-        left.set(-speed);
-    }
-
-    public void setRight(double speed) {
-        right.set(-speed);
-    }
-
-    public void setArmSpeeds(double speed) {
-        setLeft(speed);
-        setRight(speed);
-    }
-
-    public void stop() {
-        left.set(0);
-        right.set(0);
+  private CANJaguar left, right;
+
+  public Arm() {
+    left = new CANJaguar(RobotMap.ARM_LEFT);
+    right = new CANJaguar(RobotMap.ARM_RIGHT);
+  }
+
+  public void initDefaultCommand() {
+  }
+
+  public void fineTuneControl(double d) {
+    if (Math.abs(d) < 0.05) {
+      d = 0;
+    } else if (d > 0) {
+      d *= d;
+    } else {
+      d *= -d;
     }
+    setArmSpeeds(d);
+  }
+
+  public void setLeft(double speed) {
+    left.set(-speed);
+  }
+
+  public void setRight(double speed) {
+    right.set(-speed);
+  }
+
+  public void setArmSpeeds(double speed) {
+    setLeft(speed);
+    setRight(speed);
+  }
+
+  public void stop() {
+    left.set(0);
+    right.set(0);
+  }
 }
index 3738f592332ac0bf89d12c444e6fcc696b77b6c1..f3db1b5167a9f3aba6faa5ab3fba2a4386a665f8 100644 (file)
@@ -11,40 +11,40 @@ import edu.wpi.first.wpilibj.command.Subsystem;
 
 public class Claw extends Subsystem {
 
-    private DoubleSolenoid solenoid;
-    public boolean toggleOn = false;
-
-    public Claw() {
-        solenoid = new DoubleSolenoid(RobotMap.MODULE_NUMBER,
-                RobotMap.SOLENOID_FORWARD, RobotMap.SOLENOID_REVERSE);
-    }
-
-    public void initDefaultCommand() {
-    }
-
-    public void closeClaw() {
-        solenoid.set(RobotMap.close);
-    }
-
-    public void openClaw() {
-        solenoid.set(RobotMap.open);
-    }
-
-    public boolean isOpen() {
-        return solenoid.get() == RobotMap.open;
-    }
-
-    public void doTriggerAction() {
-        if (!Robot.claw.toggleOn) {
-            if (OI.rightJoystick.getRawButton(RobotMap.TRIGGER_PORT)) {
-                if (Robot.claw.isOpen()) {
-                    new CloseClaw().start();
-                }
-            } else {
-                if (!Robot.claw.isOpen()) {
-                    new OpenClaw().start();
-                }
-            }
+  private DoubleSolenoid solenoid;
+  public boolean toggleOn = false;
+
+  public Claw() {
+    solenoid = new DoubleSolenoid(RobotMap.MODULE_NUMBER,
+        RobotMap.SOLENOID_FORWARD, RobotMap.SOLENOID_REVERSE);
+  }
+
+  public void initDefaultCommand() {
+  }
+
+  public void closeClaw() {
+    solenoid.set(RobotMap.close);
+  }
+
+  public void openClaw() {
+    solenoid.set(RobotMap.open);
+  }
+
+  public boolean isOpen() {
+    return solenoid.get() == RobotMap.open;
+  }
+
+  public void doTriggerAction() {
+    if (!Robot.claw.toggleOn) {
+      if (OI.rightJoystick.getRawButton(RobotMap.TRIGGER_PORT)) {
+        if (Robot.claw.isOpen()) {
+          new CloseClaw().start();
+        }
+      } else {
+        if (!Robot.claw.isOpen()) {
+          new OpenClaw().start();
         }
+      }
     }
+  }
 }
index dda70f85b0fc09390cbf931149d4bc066dc3c673..c02dea95c941048dd6fd9651de673386fb576864 100644 (file)
@@ -8,108 +8,108 @@ import edu.wpi.first.wpilibj.CounterBase.EncodingType;
 import edu.wpi.first.wpilibj.command.Subsystem;
 
 public class DriveTrain extends Subsystem {
-    private CANJaguar frontLeft, frontRight, rearLeft, rearRight;
-    private Encoder leftEncoder, rightEncoder;
+  private CANJaguar frontLeft, frontRight, rearLeft, rearRight;
+  private Encoder leftEncoder, rightEncoder;
 
-    public DriveTrain() {
-        frontLeft = new CANJaguar(RobotMap.DRIVE_FRONT_LEFT);
-        frontRight = new CANJaguar(RobotMap.DRIVE_FRONT_RIGHT);
-        rearLeft = new CANJaguar(RobotMap.DRIVE_REAR_LEFT);
-        rearRight = new CANJaguar(RobotMap.DRIVE_REAR_RIGHT);
-        leftEncoder = new Encoder(RobotMap.DRIVE_LEFT_A, RobotMap.DRIVE_LEFT_B,
-                false, EncodingType.k4X);
-        rightEncoder = new Encoder(RobotMap.DRIVE_RIGHT_A,
-                RobotMap.DRIVE_RIGHT_B, false, EncodingType.k4X);
-        leftEncoder.setDistancePerPulse(RobotMap.DISTANCE_PER_PULSE);
-        rightEncoder.setDistancePerPulse(RobotMap.DISTANCE_PER_PULSE);
-    }
+  public DriveTrain() {
+    frontLeft = new CANJaguar(RobotMap.DRIVE_FRONT_LEFT);
+    frontRight = new CANJaguar(RobotMap.DRIVE_FRONT_RIGHT);
+    rearLeft = new CANJaguar(RobotMap.DRIVE_REAR_LEFT);
+    rearRight = new CANJaguar(RobotMap.DRIVE_REAR_RIGHT);
+    leftEncoder = new Encoder(RobotMap.DRIVE_LEFT_A, RobotMap.DRIVE_LEFT_B,
+        false, EncodingType.k4X);
+    rightEncoder = new Encoder(RobotMap.DRIVE_RIGHT_A, RobotMap.DRIVE_RIGHT_B,
+        false, EncodingType.k4X);
+    leftEncoder.setDistancePerPulse(RobotMap.DISTANCE_PER_PULSE);
+    rightEncoder.setDistancePerPulse(RobotMap.DISTANCE_PER_PULSE);
+  }
 
-    public void resetEncoders() {
-        leftEncoder.reset();
-        rightEncoder.reset();
-    }
+  public void resetEncoders() {
+    leftEncoder.reset();
+    rightEncoder.reset();
+  }
 
-    public double getRightSpeed() {
-        // Returns inches per second
-        return rightEncoder.getRate();
-    }
+  public double getRightSpeed() {
+    // Returns inches per second
+    return rightEncoder.getRate();
+  }
 
-    public double getLeftSpeed() {
-        return leftEncoder.getRate();
-    }
-    
-    public double getAverageSpeed() {
-       return (getRightSpeed() + getLeftSpeed())/2;
-    }
+  public double getLeftSpeed() {
+    return leftEncoder.getRate();
+  }
 
-    public double getRightDistance() {
-        // Returns distance in inches
-        return rightEncoder.getDistance();
-    }
+  public double getAverageSpeed() {
+    return (getRightSpeed() + getLeftSpeed()) / 2;
+  }
 
-    public double getLeftDistance() {
-        // Returns distance in inches
-        return leftEncoder.getDistance();
-    }
+  public double getRightDistance() {
+    // Returns distance in inches
+    return rightEncoder.getDistance();
+  }
+
+  public double getLeftDistance() {
+    // Returns distance in inches
+    return leftEncoder.getDistance();
+  }
+
+  public void stop() {
+    setMotorSpeeds(0, 0);
+  }
 
-    public void stop() {
-       setMotorSpeeds(0, 0);
+  public void setMotorSpeeds(double leftSpeed, double rightSpeed) {
+    if (Math.abs(leftSpeed) < RobotMap.DRIVE_DEAD_ZONE) {
+      leftSpeed = 0;
     }
-    
-    public void setMotorSpeeds(double leftSpeed, double rightSpeed) {
-        if (Math.abs(leftSpeed) < RobotMap.DRIVE_DEAD_ZONE) {
-            leftSpeed = 0;
-        }
-        if (Math.abs(rightSpeed) < RobotMap.DRIVE_DEAD_ZONE) {
-            rightSpeed = 0;
-        }
-        this.frontLeft.set(leftSpeed);
-        this.frontRight.set(-rightSpeed);
-        this.rearLeft.set(leftSpeed);
-        this.rearRight.set(-rightSpeed);
+    if (Math.abs(rightSpeed) < RobotMap.DRIVE_DEAD_ZONE) {
+      rightSpeed = 0;
     }
+    this.frontLeft.set(leftSpeed);
+    this.frontRight.set(-rightSpeed);
+    this.rearLeft.set(leftSpeed);
+    this.rearRight.set(-rightSpeed);
+  }
 
-    public void arcadeDrive(double yVal, double twist) {
-        if (yVal < 0 && Math.abs(yVal) < 0.1125) {
-            yVal = 0;
-        } else if (yVal > 0 && Math.abs(yVal) < 0.25) {
-            yVal = 0;
-        } else if (yVal > 0) {
-            yVal -= 0.25;
-        } else if (yVal < 0) {
-            yVal += 0.15;
-        }
-        if (Math.abs(twist) < RobotMap.DRIVE_DEAD_ZONE) {
-            twist = 0;
-        }
-
-        double leftMotorSpeed;
-        double rightMotorSpeed;
-        // adjust the sensitivity (yVal+rootof (yval)) / 2
-        yVal = (yVal + Math.signum(yVal) * Math.sqrt(Math.abs(yVal))) / 2;
-        // adjust the sensitivity (twist+rootof (twist)) / 2
-        twist = (twist + Math.signum(twist) * Math.sqrt(Math.abs(twist))) / 2;
-        if (yVal > 0) {
-            if (twist > 0) {
-                leftMotorSpeed = yVal - twist;
-                rightMotorSpeed = Math.max(yVal, twist);
-            } else {
-                leftMotorSpeed = Math.max(yVal, -twist);
-                rightMotorSpeed = yVal + twist;
-            }
-        } else {
-            if (twist > 0.0) {
-                leftMotorSpeed = -Math.max(-yVal, twist);
-                rightMotorSpeed = yVal + twist;
-            } else {
-                leftMotorSpeed = yVal - twist;
-                rightMotorSpeed = -Math.max(-yVal, -twist);
-            }
-        }
-        setMotorSpeeds(leftMotorSpeed, rightMotorSpeed);
+  public void arcadeDrive(double yVal, double twist) {
+    if (yVal < 0 && Math.abs(yVal) < 0.1125) {
+      yVal = 0;
+    } else if (yVal > 0 && Math.abs(yVal) < 0.25) {
+      yVal = 0;
+    } else if (yVal > 0) {
+      yVal -= 0.25;
+    } else if (yVal < 0) {
+      yVal += 0.15;
+    }
+    if (Math.abs(twist) < RobotMap.DRIVE_DEAD_ZONE) {
+      twist = 0;
     }
 
-    @Override
-    protected void initDefaultCommand() {
+    double leftMotorSpeed;
+    double rightMotorSpeed;
+    // adjust the sensitivity (yVal+rootof (yval)) / 2
+    yVal = (yVal + Math.signum(yVal) * Math.sqrt(Math.abs(yVal))) / 2;
+    // adjust the sensitivity (twist+rootof (twist)) / 2
+    twist = (twist + Math.signum(twist) * Math.sqrt(Math.abs(twist))) / 2;
+    if (yVal > 0) {
+      if (twist > 0) {
+        leftMotorSpeed = yVal - twist;
+        rightMotorSpeed = Math.max(yVal, twist);
+      } else {
+        leftMotorSpeed = Math.max(yVal, -twist);
+        rightMotorSpeed = yVal + twist;
+      }
+    } else {
+      if (twist > 0.0) {
+        leftMotorSpeed = -Math.max(-yVal, twist);
+        rightMotorSpeed = yVal + twist;
+      } else {
+        leftMotorSpeed = yVal - twist;
+        rightMotorSpeed = -Math.max(-yVal, -twist);
+      }
     }
+    setMotorSpeeds(leftMotorSpeed, rightMotorSpeed);
+  }
+
+  @Override
+  protected void initDefaultCommand() {
+  }
 }