This repository was archived by the owner on Jan 17, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConstants.java
More file actions
65 lines (53 loc) · 1.98 KB
/
Constants.java
File metadata and controls
65 lines (53 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package org.curtinfrc.frc2025;
import static org.curtinfrc.frc2025.subsystems.vision.VisionConstants.aprilTagLayout;
import edu.wpi.first.util.struct.Struct;
import edu.wpi.first.util.struct.StructGenerator;
import edu.wpi.first.util.struct.StructSerializable;
import edu.wpi.first.wpilibj.RobotBase;
import org.curtinfrc.frc2025.subsystems.drive.DriveConstants.DriveSetpoints;
import org.curtinfrc.frc2025.subsystems.elevator.Elevator.ElevatorSetpoints;
/**
* This class defines the runtime mode used by AdvantageKit. The mode is always "real" when running
* on a roboRIO. Change the value of "simMode" to switch between "sim" (physics sim) and "replay"
* (log replay from a file).
*/
public final class Constants {
public static final RobotType robotType = RobotType.SIMBOT;
public static final double ROBOT_X = 0.705;
public static final double ROBOT_Y = 0.730;
public static final double FIELD_LENGTH = aprilTagLayout.getFieldLength();
public static final double FIELD_WIDTH = aprilTagLayout.getFieldWidth();
public static final Mode getMode() {
return switch (robotType) {
case DEVBOT, COMPBOT -> RobotBase.isReal() ? Mode.REAL : Mode.REPLAY;
case SIMBOT -> Mode.SIM;
};
}
public static enum RobotType {
/** Running in simulation */
SIMBOT,
/** Running competition robot. */
COMPBOT,
/** Running developer robot. */
DEVBOT,
}
public static enum Mode {
/** Running on a real robot. */
REAL,
/** Running a physics simulator. */
SIM,
/** Replaying from a log file. */
REPLAY
}
public static void main(String... args) {
if (robotType == RobotType.SIMBOT) {
System.out.println("Invalid robot type selected for deploy: SIMBOT.");
System.exit(1);
}
}
// Setpoints
public static record Setpoint(ElevatorSetpoints elevatorSetpoint, DriveSetpoints driveSetpoint)
implements StructSerializable {
public static final Struct<Setpoint> struct = StructGenerator.genRecord(Setpoint.class);
}
}