| 1 | package org.usfirst.frc.team3501.robot; |
| 2 | |
| 3 | import edu.wpi.first.wpilibj.DoubleSolenoid; |
| 4 | import edu.wpi.first.wpilibj.DoubleSolenoid.Value; |
| 5 | import edu.wpi.first.wpilibj.I2C; |
| 6 | import edu.wpi.first.wpilibj.I2C.Port; |
| 7 | |
| 8 | /** |
| 9 | * The Constants stores constant values for all subsystems. This includes the |
| 10 | * port values for motors and sensors, as well as important operational |
| 11 | * constants for subsystems such as max and min values. |
| 12 | */ |
| 13 | |
| 14 | public class Constants { |
| 15 | public static class OI { |
| 16 | // Computer Ports |
| 17 | public final static int LEFT_STICK_PORT = 0; |
| 18 | public final static int RIGHT_STICK_PORT = 1; |
| 19 | |
| 20 | public final static int PASS_PORTCULLIS_PORT = 0; |
| 21 | public final static int PASS_CHEVAL_DE_FRISE_PORT = 0; |
| 22 | public final static int PASS_DRAWBRIDGE_PORT = 0; |
| 23 | public final static int PASS_SALLYPORT_PORT = 0; |
| 24 | |
| 25 | public final static int ARCADE_INTAKEARM_LEVEL_ONE_PORT = 0; |
| 26 | public final static int ARCADE_INTAKEARM_LEVEL_TWO_PORT = 0; |
| 27 | public final static int ARCADE_INTAKEARM_LEVEL_THREE_PORT = 0; |
| 28 | public final static int ARCADE_INTAKEARM_LEVEL_FOUR_PORT = 0; |
| 29 | |
| 30 | public final static int LEFT_JOYSTICK_TRIGGER_PORT = 0; |
| 31 | public final static int SPIN1_PORT = 4; |
| 32 | public final static int SPIN2_PORT = 5; |
| 33 | public final static int LEFT_JOYSTICK_TOP_CENTER_PORT = 3; |
| 34 | public final static int LEFT_JOYSTICK_TOP_LOW_PORT = 2; |
| 35 | |
| 36 | public final static int RIGHT_JOYSTICK_TRIGGER_PORT = 0; |
| 37 | public final static int RIGHT_JOYSTICK_THUMB_PORT = 2; |
| 38 | |
| 39 | public final static int TOGGLE_SCALING_PORT = 0; |
| 40 | |
| 41 | } |
| 42 | |
| 43 | public static class DriveTrain { |
| 44 | // Drivetrain Motor Related Ports |
| 45 | public static final int FRONT_LEFT = 1; |
| 46 | public static final int FRONT_RIGHT = 4; |
| 47 | public static final int REAR_LEFT = 2; |
| 48 | public static final int REAR_RIGHT = 3; |
| 49 | |
| 50 | // Encoder related ports |
| 51 | public final static int ENCODER_LEFT_A = 0; |
| 52 | public final static int ENCODER_LEFT_B = 1; |
| 53 | public final static int ENCODER_RIGHT_A = 9; |
| 54 | public final static int ENCODER_RIGHT_B = 8; |
| 55 | |
| 56 | public final static int FORWARD_CHANNEL = 0; |
| 57 | public final static int REVERSE_CHANNEL = 0; |
| 58 | |
| 59 | private final static double WHEEL_DIAMETER = 6.0; // in inches |
| 60 | private final static double PULSES_PER_ROTATION = 256; // in pulses |
| 61 | private final static double OUTPUT_SPROCKET_DIAMETER = 2.0; // in inches |
| 62 | private final static double WHEEL_SPROCKET_DIAMETER = 3.5; // in inches |
| 63 | public static final double INCHES_PER_PULSE = ((3.66 / 5.14) * 6 * Math.PI) |
| 64 | / 256; |
| 65 | |
| 66 | public static final int MANUAL_MODE = 1, ENCODER_MODE = 2, GYRO_MODE = 3; |
| 67 | public static final int LEFT_FORWARD = 0, LEFT_REVERSE = 1, |
| 68 | RIGHT_FORWARD = 2, RIGHT_REVERSE = 3; |
| 69 | public static double time = 0; |
| 70 | |
| 71 | // Gearing constants |
| 72 | public static final Value HIGH_GEAR = DoubleSolenoid.Value.kForward; |
| 73 | public static final Value LOW_GEAR = DoubleSolenoid.Value.kReverse; |
| 74 | |
| 75 | public static boolean inverted = false; |
| 76 | |
| 77 | public static final double PASS_DEFENSE_TIMEOUT = 10; // find this |
| 78 | } |
| 79 | |
| 80 | public static class Scaler { |
| 81 | // Piston channels |
| 82 | public final static int FORWARD_CHANNEL = 0; |
| 83 | public final static int REVERSE_CHANNEL = 1; |
| 84 | |
| 85 | // Winch port |
| 86 | public final static int WINCH_MOTOR = 0; |
| 87 | |
| 88 | // Winch speeds |
| 89 | public final static double WINCH_STOP_SPEED = 0.0; |
| 90 | public final static double SCALE_SPEED = 0; |
| 91 | public final static double SECONDS_TO_CLAMP = 2.0; |
| 92 | |
| 93 | // Winch timeout |
| 94 | public final static int SECONDS_TO_SCALE = 0; |
| 95 | |
| 96 | public static boolean SCALING = false; |
| 97 | |
| 98 | } |
| 99 | |
| 100 | public static class Shooter { |
| 101 | public static final int PORT = 0; |
| 102 | public static final int PUNCH_FORWARD = 0; |
| 103 | public static final int PUNCH_REVERSE = 1; |
| 104 | public static final int ANGLE_ADJUSTER_PORT = 0; |
| 105 | |
| 106 | public static final DoubleSolenoid.Value punch = DoubleSolenoid.Value.kForward; |
| 107 | public static final DoubleSolenoid.Value retract = DoubleSolenoid.Value.kReverse; |
| 108 | |
| 109 | // Encoder port |
| 110 | public static final int ENCODER_PORT_A = 0; |
| 111 | public static final int ENCODER_PORT_B = 0; |
| 112 | public static final int HOOD_FORWARD = 2; |
| 113 | public static final int HOOD_REVERSE = 3; |
| 114 | |
| 115 | public static final Value open = Value.kForward; |
| 116 | public static final Value closed = Value.kReverse; |
| 117 | |
| 118 | public static final Port LIDAR_I2C_PORT = I2C.Port.kMXP; |
| 119 | |
| 120 | public static enum State { |
| 121 | RUNNING, STOPPED; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | public static class DeadReckoning { |
| 126 | public static final double DEFAULT_SPEED = 0.5; |
| 127 | public static boolean isUsingTimeToPassDefense = true; |
| 128 | |
| 129 | // dead reckoning time and speed constants for driving through defenses |
| 130 | public static double passRockWallTime = 0; |
| 131 | public static double passRockWallSpeed = 0; |
| 132 | public static double passRockWallDistance = 0; |
| 133 | public static double passLowBarTime = 0; |
| 134 | public static double passLowBarSpeed = 0; |
| 135 | public static double passLowBarDistance = 0; |
| 136 | public static double passMoatTime = 0; |
| 137 | public static double passMoatSpeed = 0; |
| 138 | public static double passMoatDistance = 0; |
| 139 | public static double passRampartTime = 0; |
| 140 | public static double passRampartSpeed = 0; |
| 141 | public static double passRampartDistance = 0; |
| 142 | public static double passRoughTerrainTime = 0; |
| 143 | public static double passRoughTerrainSpeed = 0; |
| 144 | public static double passRoughTerrainDistance = 0; |
| 145 | |
| 146 | } |
| 147 | |
| 148 | public static class IntakeArm { |
| 149 | public static final int ROLLER_PORT = 0; |
| 150 | public static final int ARM_PORT = 1; |
| 151 | public static final int POT_CHANNEL = 0; |
| 152 | public static final double INTAKE_SPEED = 0.5; |
| 153 | public static final double OUTPUT_SPEED = -0.5; |
| 154 | public final static double FULL_RANGE = 270.0; // in degrees |
| 155 | public final static double OFFSET = -135.0; // in degrees |
| 156 | public static final double ZERO_ANGLE = 0; |
| 157 | } |
| 158 | |
| 159 | public static class DefenseArm { |
| 160 | // Potentiometer related ports |
| 161 | public static final int ARM_CHANNEL = 0; |
| 162 | public static final int ARM_PORT = 0; |
| 163 | public static final int HAND_PORT = 1; |
| 164 | public static final int HAND_CHANNEL = 1; |
| 165 | public final static double FULL_RANGE = 270.0; // in degrees |
| 166 | public final static double OFFSET = -135.0; // in degrees |
| 167 | |
| 168 | public final static double[] armPotValue = { 0.0, 45.0, 90.0 }; // 3 |
| 169 | // level |
| 170 | public final static double ARM_LENGTH = 0; // TODO: find actual length |
| 171 | public final static double HAND_LENGTH = 0; // TODO: find actual length |
| 172 | public final static double ARM_MOUNTED_HEIGHT = 0; // TODO: find actual |
| 173 | // height |
| 174 | } |
| 175 | |
| 176 | public enum Direction { |
| 177 | UP, DOWN, RIGHT, LEFT, FORWARD, BACKWARD; |
| 178 | } |
| 179 | |
| 180 | public enum Defense { |
| 181 | PORTCULLIS, SALLY_PORT, ROUGH_TERRAIN, LOW_BAR, CHEVAL_DE_FRISE, DRAWBRIDGE, MOAT, ROCK_WALL, RAMPART; |
| 182 | } |
| 183 | } |