File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed
Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 2121 * (log replay from a file).
2222 */
2323public final class Constants {
24- public static final Mode simMode = Mode .SIM ;
24+ public static final Mode simMode = Mode .REPLAY ;
2525 public static final Mode currentMode = RobotBase .isReal () ? Mode .REAL : simMode ;
2626
2727 public enum Mode {
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ public void robotPeriodic() {
111111 // This must be called from the robot's periodic block in order for anything in
112112 // the Command-based framework to work.
113113 CommandScheduler .getInstance ().run ();
114- if (Robot . isSimulation () ) {
114+ if (Constants . currentMode != Constants . Mode . REAL ) {
115115 SimulationVisualizer .getInstance ().periodic ();
116116 }
117117
Original file line number Diff line number Diff line change @@ -23,12 +23,15 @@ public Arm(ArmIO io) {
2323 @ Override
2424 public void periodic () {
2525 io .updateState (replayedInputs );
26+ // `processInputs` must be called every periodic after updating hardware state.
27+ // In `REPLAY` mode, `updateState` does nothing, and the `replayedInputs` are populated from the replayed logs
28+ // instead.
2629 Logger .processInputs ("Arm" , replayedInputs );
2730 }
2831
2932 @ Override
3033 public void simulationPeriodic () {
31- SimulationVisualizer .getInstance ().updateArmRotation (io . getArmPosition ( ));
34+ SimulationVisualizer .getInstance ().updateArmRotation (Degrees . of ( replayedInputs . armPositionDegrees ));
3235 }
3336
3437 public void setArmPosition (ArmPositions armPosition ) {
Original file line number Diff line number Diff line change 11package frc .robot .subsystems .elevator ;
22
3- import static edu .wpi .first .units .Units .*;
3+ import static edu .wpi .first .units .Units .Inches ;
4+ import static edu .wpi .first .units .Units .Rotations ;
5+ import static edu .wpi .first .units .Units .Volts ;
46
57import edu .wpi .first .units .measure .Angle ;
68import edu .wpi .first .units .measure .Distance ;
@@ -33,7 +35,9 @@ public void stopElevator() {
3335 @ Override
3436 public void periodic () {
3537 io .updateState (replayedInputs );
36- // Must be called every periodic after updating hardware state.
38+ // `processInputs` must be called every periodic after updating hardware state.
39+ // In `REPLAY` mode, `updateState` does nothing, and the `replayedInputs` are populated from the replayed logs
40+ // instead.
3741 Logger .processInputs ("Elevator" , replayedInputs );
3842 Logger .recordOutput (
3943 "Elevator/Desired Carriage Position" ,
@@ -42,7 +46,7 @@ public void periodic() {
4246
4347 @ Override
4448 public void simulationPeriodic () {
45- SimulationVisualizer .getInstance ().updateElevatorHeight (io . getCarriagePosition ( ));
49+ SimulationVisualizer .getInstance ().updateElevatorHeight (Inches . of ( replayedInputs . carriagePositionInches ));
4650 }
4751
4852 public void setElevatorPosition (ElevatorHeight height ) {
You can’t perform that action at this time.
0 commit comments