+++ /dev/null
-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());
-
- }
-}
+++ /dev/null
-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());
- }
- }
-}
+++ /dev/null
-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;
- }
-}
--- /dev/null
+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));
+ }
+
+
+}
import edu.wpi.first.wpilibj.command.Command;
-import org.usfirst.frc3501.RiceCatRobot.Robot;
+import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
/**
*
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;
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;
package org.usfirst.frc3501.RiceCatRobot.commands;
-import org.usfirst.frc3501.RiceCatRobot.Robot;
+import org.usfirst.frc3501.RiceCatRobot.robot.Robot;
import org.usfirst.frc3501.RiceCatRobot.subsystems.DriveTrain;
import edu.wpi.first.wpilibj.command.Command;
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.
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;
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;
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;
--- /dev/null
+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());
+
+ }
+}
--- /dev/null
+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());
+ }
+ }
+}
--- /dev/null
+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;
+ }
+}
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;
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;
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;