From bb12771d493343e09c92f73b6a8f0a2426c3c637 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Sun, 25 Feb 2024 12:17:18 -0500 Subject: [PATCH] Fix flex sim --- .../com/revrobotics/SimableCANSparkFlex.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/snobot_sim_java_revlib/src/main/java/com/revrobotics/SimableCANSparkFlex.java b/snobot_sim_java_revlib/src/main/java/com/revrobotics/SimableCANSparkFlex.java index 56f3c82..aaa0540 100644 --- a/snobot_sim_java_revlib/src/main/java/com/revrobotics/SimableCANSparkFlex.java +++ b/snobot_sim_java_revlib/src/main/java/com/revrobotics/SimableCANSparkFlex.java @@ -43,6 +43,17 @@ public REVLibError follow(final CANSparkBase leader) return mSimHelper.follow(leader); } + @Override + public SparkPIDController getPIDController() + { + if (RobotBase.isReal()) + { + return super.getPIDController(); + } + + return mSimHelper.getPIDController(); + } + @Override /* default */ REVLibError setpointCommand(double value, ControlType ctrl, int pidSlot, double arbFeedforward, int arbFFUnits) { @@ -53,4 +64,13 @@ public REVLibError follow(final CANSparkBase leader) return mSimHelper.setpointCommand(value, ctrl, pidSlot, arbFeedforward, arbFFUnits); } + + @Override + public RelativeEncoder getEncoder(SparkRelativeEncoder.Type encoderType, int countsPerRev) + { + return mSimHelper.setLatchedEncoder(super.getEncoder(encoderType, countsPerRev)); + } + + ////////////////////////////////////////////////// + }