2020-01-09 23:55:46 +00:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
|
|
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
package frc4388.robot;
|
|
|
|
|
|
2020-02-25 23:18:17 -07:00
|
|
|
import com.ctre.phoenix.motorcontrol.SupplyCurrentLimitConfiguration;
|
|
|
|
|
|
2020-02-12 22:15:50 -07:00
|
|
|
import edu.wpi.first.wpilibj.kinematics.DifferentialDriveKinematics;
|
2020-03-02 21:23:33 -07:00
|
|
|
import frc4388.utility.Gains;
|
2020-01-09 23:55:46 +00:00
|
|
|
import frc4388.utility.LEDPatterns;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean
|
|
|
|
|
* constants. This class should not be used for any other purpose. All constants should be
|
|
|
|
|
* declared globally (i.e. public static). Do not put anything functional in this class.
|
|
|
|
|
*
|
|
|
|
|
* <p>It is advised to statically import this class (or one of its inner classes) wherever the
|
|
|
|
|
* constants are needed, to reduce verbosity.
|
|
|
|
|
*/
|
|
|
|
|
public final class Constants {
|
2020-03-06 17:28:22 -07:00
|
|
|
public static final int SELECTED_AUTO = 0;
|
2020-02-21 20:15:55 -07:00
|
|
|
|
2020-01-09 23:55:46 +00:00
|
|
|
public static final class DriveConstants {
|
2020-01-18 15:12:48 -07:00
|
|
|
/* Drive Train IDs */
|
2020-01-09 23:55:46 +00:00
|
|
|
public static final int DRIVE_LEFT_FRONT_CAN_ID = 2;
|
|
|
|
|
public static final int DRIVE_RIGHT_FRONT_CAN_ID = 4;
|
|
|
|
|
public static final int DRIVE_LEFT_BACK_CAN_ID = 3;
|
2020-01-09 18:05:16 -07:00
|
|
|
public static final int DRIVE_RIGHT_BACK_CAN_ID = 5;
|
|
|
|
|
public static final int PIGEON_ID = 6;
|
2020-01-13 17:53:42 -07:00
|
|
|
|
2020-02-25 23:54:10 -07:00
|
|
|
/* Drive Inversions */
|
2020-02-26 20:29:01 -07:00
|
|
|
public static final boolean isRightMotorInverted = true;
|
2020-02-25 23:54:10 -07:00
|
|
|
public static final boolean isLeftMotorInverted = false;
|
|
|
|
|
public static final boolean isRightArcadeInverted = false;
|
2021-03-27 12:00:20 -06:00
|
|
|
public static final boolean isAuxPIDInverted = false;
|
2020-02-25 23:54:10 -07:00
|
|
|
|
|
|
|
|
/* Drive Configuration */
|
2020-02-26 08:25:39 -07:00
|
|
|
public static final int DRIVE_TIMEOUT_MS = 30; // Use for all motor config
|
2020-03-07 10:08:36 -07:00
|
|
|
public static final double OPEN_LOOP_RAMP_RATE = 0.2; // Seconds from 0 to full power on motor
|
2020-02-25 23:54:10 -07:00
|
|
|
public static final double NEUTRAL_DEADBAND = 0.04;
|
|
|
|
|
public static final SupplyCurrentLimitConfiguration SUPPLY_CURRENT_LIMIT_CONFIG =
|
2020-02-28 20:48:22 -07:00
|
|
|
new SupplyCurrentLimitConfiguration(false, 60, 40, 2);
|
2020-02-26 08:25:39 -07:00
|
|
|
public static final int CLOSED_LOOP_TIME_MS = 1; // Higher numbers mean slower control loops
|
2020-03-02 17:34:10 -07:00
|
|
|
public static final double COS_MULTIPLIER_LOW = 1.0;
|
|
|
|
|
public static final double COS_MULTIPLIER_HIGH = 0.8;
|
2020-02-26 08:25:39 -07:00
|
|
|
|
|
|
|
|
/* Drive Train Characteristics */
|
2020-03-07 13:58:41 -07:00
|
|
|
public static final double MOTOR_ROT_PER_WHEEL_ROT_HIGH = 7.29;
|
2020-02-26 08:25:39 -07:00
|
|
|
public static final double MOTOR_ROT_PER_WHEEL_ROT_LOW = 15;
|
|
|
|
|
public static final double WHEEL_DIAMETER_INCHES = 6;
|
|
|
|
|
public static final double TICKS_PER_GYRO_REV = 8192;
|
|
|
|
|
public static final double TICKS_PER_MOTOR_REV = 2048;
|
2020-02-25 23:54:10 -07:00
|
|
|
|
2020-01-13 19:26:25 -07:00
|
|
|
/* PID Constants Drive*/
|
2020-02-25 16:15:48 -07:00
|
|
|
public static final Gains DRIVE_DISTANCE_GAINS_LOW = new Gains(0.1, 0.0, 1.0, 0.0, 0, 0.5);
|
2020-03-01 12:33:09 -07:00
|
|
|
public static final Gains DRIVE_VELOCITY_GAINS_LOW = new Gains(0.05, 0.0, 1.0, 0.025, 0, 1.0);
|
|
|
|
|
public static final Gains DRIVE_TURNING_GAINS_LOW = new Gains(0.5, 0.0, 2.0, 0.0, 0, 0.55);
|
2020-02-29 16:01:39 -07:00
|
|
|
public static final Gains DRIVE_MOTION_MAGIC_GAINS_LOW = new Gains(0.1, 0.0, 0, 0.025, 0, 1.0);
|
|
|
|
|
public static final int DRIVE_CRUISE_VELOCITY = 30000;
|
|
|
|
|
public static final int DRIVE_ACCELERATION = 23000;
|
2020-02-21 22:03:41 -07:00
|
|
|
|
2020-03-01 13:34:54 -07:00
|
|
|
public static final Gains DRIVE_DISTANCE_GAINS_HIGH = new Gains(0.1, 0.0, 0.0, 0.0, 0, 0.5);
|
2020-03-01 12:33:09 -07:00
|
|
|
public static final Gains DRIVE_VELOCITY_GAINS_HIGH = new Gains(0.1, 0.0, 0.0, 0.0, 0, 1.0);
|
|
|
|
|
public static final Gains DRIVE_TURNING_GAINS_HIGH = new Gains(0.2, 0.0, 0.0, 0.0, 0, 0.55);
|
|
|
|
|
public static final Gains DRIVE_MOTION_MAGIC_GAINS_HIGH = new Gains(0.1, 0.0, 0.0, 0.0, 0, 1.0);
|
2020-02-21 22:03:41 -07:00
|
|
|
public static final int DRIVE_CRUISE_VELOCITY_HIGH = 20000;
|
|
|
|
|
public static final int DRIVE_ACCELERATION_HIGH = 7000;
|
2020-01-18 16:12:56 -07:00
|
|
|
|
2020-03-07 18:24:58 -07:00
|
|
|
public static final Gains DRIVE_VELOCITY_GAINS_BACK = new Gains(0.0, 0.0, 0.0, 0.05, 0, 1.0);
|
2020-03-07 09:10:29 -07:00
|
|
|
|
2020-02-12 22:15:50 -07:00
|
|
|
/* Trajectory Constants */
|
2020-03-07 12:41:37 -07:00
|
|
|
public static final double MAX_SPEED_METERS_PER_SECOND = 1.0;
|
2020-03-07 09:10:29 -07:00
|
|
|
public static final double MAX_ACCELERATION_METERS_PER_SECOND_SQUARED = 1.0;
|
2020-02-13 17:58:45 -07:00
|
|
|
public static final double TRACK_WIDTH_METERS = 0.648;
|
2020-02-13 17:48:49 -07:00
|
|
|
public static final DifferentialDriveKinematics kDriveKinematics = new DifferentialDriveKinematics(TRACK_WIDTH_METERS);
|
|
|
|
|
|
2020-01-18 16:12:56 -07:00
|
|
|
/* Remote Sensors */
|
|
|
|
|
public final static int REMOTE_0 = 0;
|
|
|
|
|
public final static int REMOTE_1 = 1;
|
|
|
|
|
|
|
|
|
|
/* PID Indexes */
|
|
|
|
|
public final static int PID_PRIMARY = 0;
|
|
|
|
|
public final static int PID_TURN = 1;
|
|
|
|
|
|
|
|
|
|
/* PID SLOTS */
|
|
|
|
|
public final static int SLOT_DISTANCE = 0;
|
|
|
|
|
public final static int SLOT_VELOCITY = 1;
|
|
|
|
|
public final static int SLOT_TURNING = 2;
|
|
|
|
|
public final static int SLOT_MOTION_MAGIC = 3;
|
2020-01-13 17:53:42 -07:00
|
|
|
|
2020-01-18 15:12:48 -07:00
|
|
|
/* Ratio Calculation */
|
2020-02-25 16:15:48 -07:00
|
|
|
public static final double INCHES_PER_WHEEL_REV = WHEEL_DIAMETER_INCHES * Math.PI;
|
2020-01-18 15:12:48 -07:00
|
|
|
public static final double TICK_TIME_TO_SECONDS = 0.1;
|
|
|
|
|
public static final double SECONDS_TO_TICK_TIME = 1/TICK_TIME_TO_SECONDS;
|
2020-02-12 21:32:33 -07:00
|
|
|
public static final double INCHES_PER_METER = 39.370;
|
2020-02-13 17:58:45 -07:00
|
|
|
public static final double METERS_PER_INCH = 1/INCHES_PER_METER;
|
2020-02-25 16:15:48 -07:00
|
|
|
|
|
|
|
|
public static final double WHEEL_ROT_PER_MOTOR_ROT_HIGH = 1/MOTOR_ROT_PER_WHEEL_ROT_HIGH;
|
|
|
|
|
public static final double TICKS_PER_WHEEL_REV_HIGH = TICKS_PER_MOTOR_REV * MOTOR_ROT_PER_WHEEL_ROT_HIGH;
|
|
|
|
|
public static final double TICKS_PER_INCH_HIGH = TICKS_PER_WHEEL_REV_HIGH/INCHES_PER_WHEEL_REV;
|
|
|
|
|
public static final double INCHES_PER_TICK_HIGH = 1/TICKS_PER_INCH_HIGH;
|
|
|
|
|
|
|
|
|
|
public static final double WHEEL_ROT_PER_MOTOR_ROT_LOW = 1/MOTOR_ROT_PER_WHEEL_ROT_LOW;
|
|
|
|
|
public static final double TICKS_PER_WHEEL_REV_LOW = TICKS_PER_MOTOR_REV * MOTOR_ROT_PER_WHEEL_ROT_LOW;
|
|
|
|
|
public static final double TICKS_PER_INCH_LOW = TICKS_PER_WHEEL_REV_LOW/INCHES_PER_WHEEL_REV;
|
|
|
|
|
public static final double INCHES_PER_TICK_LOW = 1/TICKS_PER_INCH_LOW;
|
2020-01-09 23:55:46 +00:00
|
|
|
}
|
2020-02-11 00:16:16 +00:00
|
|
|
|
2020-01-18 15:28:48 -08:00
|
|
|
public static final class ShooterConstants {
|
2020-02-11 16:09:31 -08:00
|
|
|
/* Motor IDs */
|
2021-02-26 12:36:28 -07:00
|
|
|
public static final int SHOOTER_FALCON_BALLER_ID = 8;
|
|
|
|
|
public static final int SHOOTER_FALCON_BALLER_FOLLOWER_ID = 15;
|
2020-03-01 11:24:57 -07:00
|
|
|
public static final int SHOOTER_ANGLE_ADJUST_ID = 10;
|
|
|
|
|
public static final int SHOOTER_ROTATE_ID = 9;
|
2020-01-09 23:55:46 +00:00
|
|
|
|
2020-01-18 15:28:48 -08:00
|
|
|
/* PID Constants Shooter */
|
|
|
|
|
public static final int SHOOTER_SLOT_IDX = 0;
|
|
|
|
|
public static final int SHOOTER_PID_LOOP_IDX = 1;
|
|
|
|
|
public static final int SHOOTER_TIMEOUT_MS = 30;
|
2021-03-05 12:24:11 -07:00
|
|
|
public static final Gains DRUM_SHOOTER_GAINS = new Gains(0.34, 0.0, 0.0, 0.055, 0, 1.0); //Ff was 0.055
|
2020-03-12 19:15:36 -06:00
|
|
|
//public static final Gains DRUM_SHOOTER_GAINS = new Gains(0.55, 0.0, 100, 0.0, 0, 1.0);
|
|
|
|
|
public static final Gains SHOOTER_TURRET_GAINS = new Gains(0.6, 0.0, 0.0, 0.0, 0, 1.0);
|
2020-03-03 20:59:00 -07:00
|
|
|
public static final Gains SHOOTER_ANGLE_GAINS = new Gains(0.05, 0.0, 0.0, 0.0, 0, 0.3);
|
2020-02-13 19:12:08 -08:00
|
|
|
public static final double SHOOTER_TURRET_MIN = -1.0;
|
2020-01-18 15:28:48 -08:00
|
|
|
public static final double ENCODER_TICKS_PER_REV = 2048;
|
2020-02-11 16:09:31 -08:00
|
|
|
public static final double NEO_UNITS_PER_REV = 42;
|
|
|
|
|
public static final double DEGREES_PER_ROT = 360;
|
2020-03-01 00:41:23 -07:00
|
|
|
|
2020-03-03 20:59:00 -07:00
|
|
|
public static final SupplyCurrentLimitConfiguration SUPPLY_CURRENT_LIMIT_CONFIG =
|
|
|
|
|
new SupplyCurrentLimitConfiguration(true, 60, 40, 0.5);
|
|
|
|
|
|
2020-03-01 00:41:23 -07:00
|
|
|
public static final int TURRET_RIGHT_SOFT_LIMIT = -2;
|
|
|
|
|
public static final int TURRET_LEFT_SOFT_LIMIT = -55;
|
|
|
|
|
public static final double TURRET_SPEED_MULTIPLIER = 0.3;
|
|
|
|
|
public static final double TURRET_CALIBRATE_SPEED = 0.075;
|
2020-03-12 19:15:36 -06:00
|
|
|
public static final double TURRET_MOTOR_ROTS_PER_ROT = 101.04972; //89.56696;
|
|
|
|
|
public static final double TURRET_MOTOR_POS_AT_ZERO_ROT = -28.452166;
|
2020-03-01 00:41:23 -07:00
|
|
|
|
|
|
|
|
public static final int HOOD_UP_SOFT_LIMIT = 33;
|
|
|
|
|
public static final int HOOD_DOWN_SOFT_LIMIT = 3;
|
|
|
|
|
public static final double HOOD_CONVERT_SLOPE = 0.47;
|
|
|
|
|
public static final double HOOD_CONVERT_B = 40.5;
|
2020-03-02 21:03:39 -07:00
|
|
|
public static final double HOOD_CALIBRATE_SPEED = 0.2;
|
2020-03-08 15:20:55 -06:00
|
|
|
public static final double HOOD_MOTOR_ROTS_PER_ROT = 1; //TODO: Find
|
|
|
|
|
public static final double HOOD_MOTOR_POS_AT_ZERO_ROT = 0; //TODO: Find
|
2020-03-01 00:41:23 -07:00
|
|
|
|
|
|
|
|
public static final double DRUM_RAMP_LIMIT = 1000;
|
|
|
|
|
public static final double DRUM_VELOCITY_BOUND = 300;
|
2020-01-13 19:50:26 -07:00
|
|
|
}
|
2020-01-28 18:56:09 -08:00
|
|
|
|
|
|
|
|
public static final class ClimberConstants {
|
2020-03-01 11:24:57 -07:00
|
|
|
public static final int CLIMBER_SPARK_ID = 14;
|
2020-01-28 18:56:09 -08:00
|
|
|
}
|
2020-02-08 21:17:29 +00:00
|
|
|
|
2020-02-06 19:51:17 -07:00
|
|
|
public static final class LevelerConstants {
|
2021-02-26 12:36:28 -07:00
|
|
|
public static final int LEVELER_CAN_ID = 30;
|
2020-02-06 19:51:17 -07:00
|
|
|
}
|
2020-03-08 13:50:39 -06:00
|
|
|
|
|
|
|
|
public static final class IntakeConstants {;
|
|
|
|
|
public static final double EXTENDER_SPEED = 0.3;
|
|
|
|
|
public static final double INTAKE_SPEED = 1.0;
|
|
|
|
|
|
|
|
|
|
public static final int INTAKE_SPARK_ID = 12;
|
|
|
|
|
public static final int EXTENDER_SPARK_ID = 13;
|
|
|
|
|
}
|
2020-02-08 21:17:29 +00:00
|
|
|
|
2020-01-28 17:07:49 -08:00
|
|
|
public static final class StorageConstants {
|
2020-03-01 11:24:57 -07:00
|
|
|
public static final int STORAGE_CAN_ID = 11;
|
2020-02-22 10:37:56 -07:00
|
|
|
public static final double STORAGE_PARTIAL_BALL = 2;
|
|
|
|
|
public static final double STORAGE_FULL_BALL = 7;
|
2021-01-28 17:23:29 -07:00
|
|
|
public static final double STORAGE_SPEED = 0.75;
|
2020-03-08 13:33:57 -06:00
|
|
|
public static final double STORAGE_TIMEOUT = 3000;
|
2020-02-10 16:57:41 -08:00
|
|
|
|
2020-03-08 12:14:24 -06:00
|
|
|
/* Storage Characteristics */
|
|
|
|
|
public static final double MOTOR_ROTS_PER_STORAGE_ROT = 1; //For the first storage belt
|
|
|
|
|
public static final double INCHES_PER_STORAGE_ROT = 1; //Circumference of the first storage belt
|
2020-02-10 16:57:41 -08:00
|
|
|
|
|
|
|
|
/* Ball Indexes */
|
2020-03-09 19:07:51 -06:00
|
|
|
public static final int BEAM_SENSOR_SHOOTER = 11;
|
|
|
|
|
public static final int BEAM_SENSOR_USELESS = 12;
|
|
|
|
|
public static final int BEAM_SENSOR_STORAGE = 13;
|
|
|
|
|
public static final int BEAM_SENSOR_INTAKE = 14;
|
2020-02-10 16:57:41 -08:00
|
|
|
|
2020-03-08 12:14:24 -06:00
|
|
|
/* PID Gains */
|
|
|
|
|
public static final Gains STORAGE_GAINS = new Gains(0.1, 0.0, 0.0, 0.0, 0, 1.0);
|
2020-02-10 16:57:41 -08:00
|
|
|
|
|
|
|
|
/* PID Values */
|
|
|
|
|
public static final int SLOT_DISTANCE = 0;
|
|
|
|
|
|
|
|
|
|
/* PID Indexes */
|
|
|
|
|
public static final int PID_PRIMARY = 0;
|
2020-01-28 17:07:49 -08:00
|
|
|
}
|
2020-02-26 17:26:49 -07:00
|
|
|
|
|
|
|
|
public static final class PneumaticsConstants {
|
|
|
|
|
public static final int PCM_MODULE_ID = 7;
|
|
|
|
|
|
|
|
|
|
public static final int SPEED_SHIFT_FORWARD_ID = 0;
|
|
|
|
|
public static final int SPEED_SHIFT_REVERSE_ID = 1;
|
|
|
|
|
|
|
|
|
|
public static final int COOL_FALCON_FORWARD_ID = 3;
|
|
|
|
|
public static final int COOL_FALCON_REVERSE_ID = 2;
|
2020-01-28 17:07:49 -08:00
|
|
|
}
|
2020-02-08 21:17:29 +00:00
|
|
|
|
2020-01-09 23:55:46 +00:00
|
|
|
public static final class LEDConstants {
|
|
|
|
|
public static final int LED_SPARK_ID = 0;
|
|
|
|
|
public static final LEDPatterns DEFAULT_PATTERN = LEDPatterns.FOREST_WAVES;
|
|
|
|
|
}
|
2020-02-10 20:17:19 -07:00
|
|
|
|
|
|
|
|
public static final class VisionConstants {
|
|
|
|
|
public static final double FOV = 29.8; //Field of view of limelight
|
2021-03-04 17:26:04 -07:00
|
|
|
public static final double TARGET_HEIGHT = 67.5;
|
2020-03-07 17:38:14 -07:00
|
|
|
public static final double LIME_ANGLE = 24.7;
|
2020-03-12 19:15:36 -06:00
|
|
|
public static final double TURN_P_VALUE = 0.8;
|
2021-03-12 12:37:06 -07:00
|
|
|
public static final double X_ANGLE_ERROR = 0.5;
|
2020-03-12 19:15:36 -06:00
|
|
|
public static final double MOTOR_DEAD_ZONE = 0.2;
|
2020-02-10 20:17:19 -07:00
|
|
|
public static final double DISTANCE_ERROR_EQUATION_M = 1.1279;
|
|
|
|
|
public static final double DISTANCE_ERROR_EQUATION_B = -15.0684;
|
2020-02-19 20:48:34 -07:00
|
|
|
public static final double GRAV = 385.83;
|
2021-03-19 01:34:57 -06:00
|
|
|
|
|
|
|
|
//Galactic Search
|
2021-04-07 20:34:13 -06:00
|
|
|
public static final double searchError = 2;
|
2021-04-01 16:44:38 -06:00
|
|
|
/*public static final double bothCloseVisibleY = -17.69;
|
2021-03-21 17:29:31 -06:00
|
|
|
public static final double closeLeftVisibleY = -12.57;
|
|
|
|
|
public static final double closeRightVisibleY = -11.35;
|
|
|
|
|
public static final double farLeftVisibleX = 3.58;
|
2021-04-01 16:44:38 -06:00
|
|
|
public static final double farRightVisibleX = 7.04;*/
|
2021-04-03 11:11:44 -06:00
|
|
|
|
2021-04-07 20:34:13 -06:00
|
|
|
public static final double[] aRed = {1.6, -11.7};
|
|
|
|
|
public static final double[] bRed = {2.5, -5.5};
|
2021-04-03 14:11:05 -06:00
|
|
|
public static final double[] aBlue = {9.9, 9.0};
|
2021-04-05 19:51:37 -06:00
|
|
|
public static final double[] bBlue = {5.5, 13.3};
|
2021-04-03 11:11:44 -06:00
|
|
|
|
2020-02-10 20:17:19 -07:00
|
|
|
}
|
2020-01-09 23:55:46 +00:00
|
|
|
|
|
|
|
|
public static final class OIConstants {
|
|
|
|
|
public static final int XBOX_DRIVER_ID = 0;
|
|
|
|
|
public static final int XBOX_OPERATOR_ID = 1;
|
2020-03-10 18:47:22 -06:00
|
|
|
public static final int BUTTON_FOX_ID = 2;
|
2020-01-09 23:55:46 +00:00
|
|
|
}
|
|
|
|
|
}
|