Merge branch 'master' of challenge-bot.com:repos/3501/2015-FRC-Spark master
authorDavid <david.dobervich@gmail.com>
Fri, 20 Nov 2015 18:37:17 +0000 (10:37 -0800)
committerDavid <david.dobervich@gmail.com>
Fri, 20 Nov 2015 18:37:17 +0000 (10:37 -0800)
20 files changed:
.gitignore
src/org/usfirst/frc3501/RiceCatRobot/OI.java [deleted file]
src/org/usfirst/frc3501/RiceCatRobot/Robot.java [deleted file]
src/org/usfirst/frc3501/RiceCatRobot/RobotMap.java [deleted file]
src/org/usfirst/frc3501/RiceCatRobot/auton/MoveForwardFiveFt.java [new file with mode: 0644]
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/MoveDistance.java [new file with mode: 0644]
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 [new file with mode: 0644]
src/org/usfirst/frc3501/RiceCatRobot/robot/Robot.java [new file with mode: 0644]
src/org/usfirst/frc3501/RiceCatRobot/robot/RobotMap.java [new file with mode: 0644]
src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java
src/org/usfirst/frc3501/RiceCatRobot/subsystems/Claw.java
src/org/usfirst/frc3501/RiceCatRobot/subsystems/DriveTrain.java

index 0686dad847402fbf6a328b8b8fda535f9e62358f..dc8e203a70f816ab5940294cffd44045fb13c78e 100644 (file)
@@ -1,7 +1,10 @@
+<<<<<<< HEAD
 # -*- mode: gitignore; -*-
 *~
 \#*\#
 .\#*
+=======
+>>>>>>> fb376f02820fc8dd8404759e2b45fa582969dc3e
 *.pydevproject
 .metadata
 .gradle
@@ -46,4 +49,8 @@ local.properties
 .texlipse
 
 # STS (Spring Tool Suite)
+<<<<<<< HEAD
 .springBeans
+=======
+.springBeans
+>>>>>>> fb376f02820fc8dd8404759e2b45fa582969dc3e
diff --git a/src/org/usfirst/frc3501/RiceCatRobot/OI.java b/src/org/usfirst/frc3501/RiceCatRobot/OI.java
deleted file mode 100644 (file)
index e463ea3..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.usfirst.frc3501.RiceCatRobot;
-
-import org.usfirst.frc3501.RiceCatRobot.commands.ToggleClaw;
-import org.usfirst.frc3501.RiceCatRobot.commands.ToggleCompressor;
-
-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 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);
-
-    toggleClaw = new JoystickButton(rightJoystick, RobotMap.TOGGLE_PORT);
-    toggleClaw.whenPressed(new ToggleClaw());
-
-    toggleCompressor = new JoystickButton(rightJoystick,
-        RobotMap.TOGGLE_COMPRESSOR_PORT);
-    toggleCompressor.whenPressed(new ToggleCompressor());
-
-  }
-}
diff --git a/src/org/usfirst/frc3501/RiceCatRobot/Robot.java b/src/org/usfirst/frc3501/RiceCatRobot/Robot.java
deleted file mode 100644 (file)
index 0e4d934..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.usfirst.frc3501.RiceCatRobot;
-
-import org.usfirst.frc3501.RiceCatRobot.subsystems.Arm;
-import org.usfirst.frc3501.RiceCatRobot.subsystems.Claw;
-import org.usfirst.frc3501.RiceCatRobot.subsystems.DriveTrain;
-
-import edu.wpi.first.wpilibj.Compressor;
-import edu.wpi.first.wpilibj.IterativeRobot;
-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;
-
-  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 autonomousPeriodic() {
-    Scheduler.getInstance().run();
-  }
-
-  public void teleopInit() {
-    System.out.println("running teleopInit");
-  }
-
-  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);
-
-    } else {
-      arm.fineTuneControl(OI.leftJoystick.getY());
-    }
-  }
-}
diff --git a/src/org/usfirst/frc3501/RiceCatRobot/RobotMap.java b/src/org/usfirst/frc3501/RiceCatRobot/RobotMap.java
deleted file mode 100644 (file)
index 7c6e996..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.usfirst.frc3501.RiceCatRobot;
-
-import edu.wpi.first.wpilibj.DoubleSolenoid;
-import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
-
-/**
- * The RobotMap is a mapping from the ports sensors and actuators are wired into
- * to a variable name. This provides flexibility changing wiring, makes checking
- * the wiring easier and significantly reduces the number of magic numbers
- * 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 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;
-
-  // 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 enum Direction {
-    LEFT, RIGHT, DOWN, UP, FORWARD, BACKWARD;
-  }
-}
diff --git a/src/org/usfirst/frc3501/RiceCatRobot/auton/MoveForwardFiveFt.java b/src/org/usfirst/frc3501/RiceCatRobot/auton/MoveForwardFiveFt.java
new file mode 100644 (file)
index 0000000..a67740e
--- /dev/null
@@ -0,0 +1,15 @@
+package org.usfirst.frc3501.RiceCatRobot.auton;
+
+import org.usfirst.frc3501.RiceCatRobot.commands.MoveDistance;
+import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.CommandGroup;
+
+public class MoveForwardFiveFt extends CommandGroup{
+       
+       public MoveForwardFiveFt (){
+               requires(Robot.driveTrain);
+               
+               addSequential(new MoveDistance(60, 0, 0.5));
+       }
+}
index 2ace9ae087380e3b22af47ecd3e0275cb38bb4be..f26f6c3730ae0e1b158d28a65963217b70d700dc 100644 (file)
@@ -2,7 +2,7 @@ package org.usfirst.frc3501.RiceCatRobot.commands;
 
 import edu.wpi.first.wpilibj.command.Command;
 
-import org.usfirst.frc3501.RiceCatRobot.Robot;
+import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
 
 /**
  *
index e2473538094e9aa233c946b99f00c017e8763669..ee6fe267ab51965b3174fe553d43608beda6c8fc 100644 (file)
@@ -1,7 +1,7 @@
 package org.usfirst.frc3501.RiceCatRobot.commands;
 
-import org.usfirst.frc3501.RiceCatRobot.Robot;
-import org.usfirst.frc3501.RiceCatRobot.RobotMap.Direction;
+import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
+import org.usfirst.frc3501.RiceCatRobot.robot.RobotMap.Direction;
 
 import edu.wpi.first.wpilibj.Timer;
 import edu.wpi.first.wpilibj.command.Command;
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 4e97d1b3084cc34e8bebcb426a5af9eee8a91746..8cdbec2c542bd42f47e2850782ac57efb322658e 100644 (file)
@@ -1,8 +1,8 @@
 package org.usfirst.frc3501.RiceCatRobot.commands;
 
-import org.usfirst.frc3501.RiceCatRobot.Robot;
-import org.usfirst.frc3501.RiceCatRobot.RobotMap;
-import org.usfirst.frc3501.RiceCatRobot.RobotMap.Direction;
+import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
+import org.usfirst.frc3501.RiceCatRobot.robot.RobotMap;
+import org.usfirst.frc3501.RiceCatRobot.robot.RobotMap.Direction;
 
 import edu.wpi.first.wpilibj.Timer;
 import edu.wpi.first.wpilibj.command.Command;
diff --git a/src/org/usfirst/frc3501/RiceCatRobot/commands/MoveDistance.java b/src/org/usfirst/frc3501/RiceCatRobot/commands/MoveDistance.java
new file mode 100644 (file)
index 0000000..6608c33
--- /dev/null
@@ -0,0 +1,48 @@
+package org.usfirst.frc3501.RiceCatRobot.commands;
+
+import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
+import org.usfirst.frc3501.RiceCatRobot.subsystems.DriveTrain;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+public class MoveDistance extends Command {
+
+       double distance, minSpeed, maxSpeed;
+
+       public MoveDistance(double distance, double minSpeed, double maxSpeed) {
+               requires(Robot.driveTrain);
+               this.distance = distance;
+               this.minSpeed = minSpeed;
+               this.maxSpeed = maxSpeed;
+       }
+
+       protected void initialize() {
+               Robot.driveTrain.resetEncoders();
+       }
+
+       @Override
+       protected void execute() {
+               double speed = 4 * (minSpeed - maxSpeed) * 
+                               Math.pow((Robot.driveTrain.getAverageSpeed() / distance - 0.5), 2) 
+                               + maxSpeed;
+               Robot.driveTrain.setMotorSpeeds(speed, speed);
+       }
+
+       @Override
+       protected boolean isFinished() {
+               if (Robot.driveTrain.getLeftDistance() > distance
+                               && Robot.driveTrain.getRightDistance() > distance)
+                       return true;
+               return false;
+       }
+
+       @Override
+       protected void end() {
+               Robot.driveTrain.stop();
+       }
+
+       @Override
+       protected void interrupted() {
+               end();
+       }
+}
index 101ae75f6e7e552a5d1c88612e9840aeda9b7295..c0d351d425d563e45311208d7101df0f21cf4704 100644 (file)
@@ -2,7 +2,7 @@ package org.usfirst.frc3501.RiceCatRobot.commands;
 
 import edu.wpi.first.wpilibj.command.Command;
 
-import org.usfirst.frc3501.RiceCatRobot.Robot;
+import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
 
 /**
  * Opens claw by reversing solenoids.
index 32f658f86b7a092ffcdf4aacf0e0300062024f78..c85ea77d46b5155a66628a2bc9eed17ca6be2aba 100644 (file)
@@ -1,6 +1,6 @@
 package org.usfirst.frc3501.RiceCatRobot.commands;
 
-import org.usfirst.frc3501.RiceCatRobot.Robot;
+import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
 
 import edu.wpi.first.wpilibj.command.Command;
 
index 64c34f9f4078296dde2b83a52a63952ec945d7e3..3669eaf88568d30fa87f176ec30ec53b13e071f4 100644 (file)
@@ -1,6 +1,6 @@
 package org.usfirst.frc3501.RiceCatRobot.commands;
 
-import org.usfirst.frc3501.RiceCatRobot.Robot;
+import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
 
 import edu.wpi.first.wpilibj.command.Command;
 
index 4abe13bd3f980ad756606282c51fabd86997107e..580fe06875f3c8badf04684ac9b8fc4af48c4808 100644 (file)
@@ -1,7 +1,7 @@
 package org.usfirst.frc3501.RiceCatRobot.commands;
 
-import org.usfirst.frc3501.RiceCatRobot.Robot;
-import org.usfirst.frc3501.RiceCatRobot.RobotMap.Direction;
+import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
+import org.usfirst.frc3501.RiceCatRobot.robot.RobotMap.Direction;
 
 import edu.wpi.first.wpilibj.Timer;
 import edu.wpi.first.wpilibj.command.Command;
diff --git a/src/org/usfirst/frc3501/RiceCatRobot/robot/OI.java b/src/org/usfirst/frc3501/RiceCatRobot/robot/OI.java
new file mode 100644 (file)
index 0000000..9c391da
--- /dev/null
@@ -0,0 +1,31 @@
+package org.usfirst.frc3501.RiceCatRobot.robot;
+
+import org.usfirst.frc3501.RiceCatRobot.commands.ToggleClaw;
+import org.usfirst.frc3501.RiceCatRobot.commands.ToggleCompressor;
+
+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 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);
+
+    toggleClaw = new JoystickButton(rightJoystick, RobotMap.TOGGLE_PORT);
+    toggleClaw.whenPressed(new ToggleClaw());
+
+    toggleCompressor = new JoystickButton(rightJoystick,
+        RobotMap.TOGGLE_COMPRESSOR_PORT);
+    toggleCompressor.whenPressed(new ToggleCompressor());
+
+  }
+}
diff --git a/src/org/usfirst/frc3501/RiceCatRobot/robot/Robot.java b/src/org/usfirst/frc3501/RiceCatRobot/robot/Robot.java
new file mode 100644 (file)
index 0000000..e83f800
--- /dev/null
@@ -0,0 +1,69 @@
+package org.usfirst.frc3501.RiceCatRobot.robot;
+
+import org.usfirst.frc3501.RiceCatRobot.subsystems.Arm;
+import org.usfirst.frc3501.RiceCatRobot.subsystems.Claw;
+import org.usfirst.frc3501.RiceCatRobot.subsystems.DriveTrain;
+
+import edu.wpi.first.wpilibj.Compressor;
+import edu.wpi.first.wpilibj.IterativeRobot;
+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;
+
+  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 autonomousPeriodic() {
+    Scheduler.getInstance().run();
+  }
+
+  public void teleopInit() {
+    System.out.println("running teleopInit");
+  }
+
+  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);
+
+    } else {
+      arm.fineTuneControl(OI.leftJoystick.getY());
+    }
+  }
+}
diff --git a/src/org/usfirst/frc3501/RiceCatRobot/robot/RobotMap.java b/src/org/usfirst/frc3501/RiceCatRobot/robot/RobotMap.java
new file mode 100644 (file)
index 0000000..90f10ec
--- /dev/null
@@ -0,0 +1,42 @@
+package org.usfirst.frc3501.RiceCatRobot.robot;
+
+import edu.wpi.first.wpilibj.DoubleSolenoid;
+import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
+
+/**
+ * The RobotMap is a mapping from the ports sensors and actuators are wired into
+ * to a variable name. This provides flexibility changing wiring, makes checking
+ * the wiring easier and significantly reduces the number of magic numbers
+ * 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 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;
+
+  // 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 enum Direction {
+    LEFT, RIGHT, DOWN, UP, FORWARD, BACKWARD;
+  }
+}
index 8d78c8f48e9e8ccac467c6617c1cc3368cb38eba..e20a822938fa2a66c26bd39bebfed9b74d3fb013 100644 (file)
@@ -1,6 +1,6 @@
 package org.usfirst.frc3501.RiceCatRobot.subsystems;
 
-import org.usfirst.frc3501.RiceCatRobot.RobotMap;
+import org.usfirst.frc3501.RiceCatRobot.robot.RobotMap;
 
 import edu.wpi.first.wpilibj.CANJaguar;
 import edu.wpi.first.wpilibj.command.Subsystem;
index b7a1f048ab4d1e1f50bebbad19ac4b4e8117d2df..f3db1b5167a9f3aba6faa5ab3fba2a4386a665f8 100644 (file)
@@ -1,10 +1,10 @@
 package org.usfirst.frc3501.RiceCatRobot.subsystems;
 
-import org.usfirst.frc3501.RiceCatRobot.OI;
-import org.usfirst.frc3501.RiceCatRobot.Robot;
-import org.usfirst.frc3501.RiceCatRobot.RobotMap;
 import org.usfirst.frc3501.RiceCatRobot.commands.CloseClaw;
 import org.usfirst.frc3501.RiceCatRobot.commands.OpenClaw;
+import org.usfirst.frc3501.RiceCatRobot.robot.OI;
+import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
+import org.usfirst.frc3501.RiceCatRobot.robot.RobotMap;
 
 import edu.wpi.first.wpilibj.DoubleSolenoid;
 import edu.wpi.first.wpilibj.command.Subsystem;
index 49ffefa32b0b5fff9c304e0462721ae55c17863c..c02dea95c941048dd6fd9651de673386fb576864 100644 (file)
@@ -1,6 +1,6 @@
 package org.usfirst.frc3501.RiceCatRobot.subsystems;
 
-import org.usfirst.frc3501.RiceCatRobot.RobotMap;
+import org.usfirst.frc3501.RiceCatRobot.robot.RobotMap;
 
 import edu.wpi.first.wpilibj.CANJaguar;
 import edu.wpi.first.wpilibj.Encoder;
@@ -30,7 +30,7 @@ public class DriveTrain extends Subsystem {
   }
 
   public double getRightSpeed() {
-    // Returns in per second
+    // Returns inches per second
     return rightEncoder.getRate();
   }
 
@@ -38,16 +38,24 @@ public class DriveTrain extends Subsystem {
     return leftEncoder.getRate();
   }
 
+  public double getAverageSpeed() {
+    return (getRightSpeed() + getLeftSpeed()) / 2;
+  }
+
   public double getRightDistance() {
-    // Returns distance in in
+    // Returns distance in inches
     return rightEncoder.getDistance();
   }
 
   public double getLeftDistance() {
-    // Returns distance in in
+    // Returns distance in inches
     return leftEncoder.getDistance();
   }
 
+  public void stop() {
+    setMotorSpeeds(0, 0);
+  }
+
   public void setMotorSpeeds(double leftSpeed, double rightSpeed) {
     if (Math.abs(leftSpeed) < RobotMap.DRIVE_DEAD_ZONE) {
       leftSpeed = 0;