|
1 | 1 | package frc.robot;
|
2 | 2 |
|
3 |
| -import edu.wpi.first.wpilibj.DriverStation; |
| 3 | +import edu.wpi.first.wpilibj.Alert; |
4 | 4 | import edu.wpi.first.wpilibj.RobotBase;
|
5 | 5 |
|
6 | 6 | public class Constants {
|
7 |
| - private static RobotType kRobotType = RobotType.ROBOT_2025_COMP; |
| 7 | + private static RobotType robotType = RobotType.COMPBOT; |
8 | 8 | // Allows tunable values to be changed when enabled. Also adds tunable selectors to AutoSelector
|
9 | 9 | public static final boolean TUNING_MODE = true;
|
10 | 10 | // Disable the AdvantageKit logger from running
|
11 | 11 | public static final boolean ENABLE_LOGGING = true;
|
12 | 12 |
|
13 | 13 | public static final double kLoopPeriodSecs = 0.02;
|
14 | 14 |
|
15 |
| - public static final double LOW_VOLTAGE_WARNING_THRESHOLD = 10.0; |
16 |
| - |
17 |
| - public enum RobotMode { |
18 |
| - REAL, |
19 |
| - SIM, |
20 |
| - REPLAY |
| 15 | + public static RobotType getRobot() { |
| 16 | + if (RobotBase.isReal() && robotType == RobotType.SIMBOT) { |
| 17 | + new Alert( |
| 18 | + "Invalid robot selected, using competition robot as default.", Alert.AlertType.kError) |
| 19 | + .set(true); |
| 20 | + robotType = RobotType.COMPBOT; |
| 21 | + } |
| 22 | + return robotType; |
21 | 23 | }
|
22 | 24 |
|
23 |
| - public enum RobotType { |
24 |
| - ROBOT_2025_COMP, |
25 |
| - ROBOT_SIMBOT |
| 25 | + public static Mode getMode() { |
| 26 | + return switch (robotType) { |
| 27 | + case COMPBOT -> RobotBase.isReal() ? Mode.REAL : Mode.REPLAY; |
| 28 | + case SIMBOT -> Mode.SIM; |
| 29 | + }; |
26 | 30 | }
|
27 | 31 |
|
28 |
| - public static RobotType getRobotType() { |
29 |
| - if (RobotBase.isReal() && kRobotType == RobotType.ROBOT_SIMBOT) { |
30 |
| - DriverStation.reportError( |
31 |
| - "Robot is set to SIM but it isn't a SIM, setting it to Competition Robot as redundancy.", |
32 |
| - false); |
33 |
| - kRobotType = RobotType.ROBOT_2025_COMP; |
34 |
| - } |
| 32 | + public enum Mode { |
| 33 | + /** Running on a real robot. */ |
| 34 | + REAL, |
35 | 35 |
|
36 |
| - if (RobotBase.isSimulation() && kRobotType != RobotType.ROBOT_SIMBOT) { |
37 |
| - DriverStation.reportError( |
38 |
| - "Robot is set to REAL but it is a SIM, setting it to SIMBOT as redundancy.", false); |
39 |
| - kRobotType = RobotType.ROBOT_SIMBOT; |
40 |
| - } |
| 36 | + /** Running a physics simulator. */ |
| 37 | + SIM, |
41 | 38 |
|
42 |
| - return kRobotType; |
| 39 | + /** Replaying from a log file. */ |
| 40 | + REPLAY |
43 | 41 | }
|
44 | 42 |
|
45 |
| - public static RobotMode getRobotMode() { |
46 |
| - if (getRobotType() == RobotType.ROBOT_SIMBOT) return RobotMode.SIM; |
47 |
| - else return RobotBase.isReal() ? RobotMode.REAL : RobotMode.REPLAY; |
| 43 | + public enum RobotType { |
| 44 | + SIMBOT, |
| 45 | + COMPBOT |
48 | 46 | }
|
49 | 47 | }
|
0 commit comments