File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import java .util .Random ;
44
55import com .revrobotics .sim .SparkFlexSim ;
6+ import com .revrobotics .sim .SparkRelativeEncoderSim ;
67
78import edu .wpi .first .math .system .plant .DCMotor ;
89import edu .wpi .first .wpilibj .simulation .ElevatorSim ;
1314public class ElevatorIOSim extends ElevatorIOVortex {
1415
1516 private final SparkFlexSim motor = new SparkFlexSim (super .leadMotor , DCMotor .getNeoVortex (2 ));
17+
18+ private final SparkRelativeEncoderSim leadEncoder = new SparkRelativeEncoderSim (super .leadMotor );
19+ private final SparkRelativeEncoderSim followerEncoder = new SparkRelativeEncoderSim (super .followerMotor );
20+
1621 private final LaserCanSim laserCan = super .laserCan .getSimulatedDevice ();
1722
1823 private final ElevatorSim elevator = new ElevatorSim (
@@ -28,6 +33,14 @@ public class ElevatorIOSim extends ElevatorIOVortex {
2833
2934 private final Random random = new Random ();
3035
36+ public ElevatorIOSim () {
37+
38+ super ();
39+
40+ this .leadEncoder .setPosition (super .leadEncoder .getPosition ());
41+ this .followerEncoder .setPosition (super .followerEncoder .getPosition ());
42+ }
43+
3144 @ Override
3245 public void updateInputs (ElevatorIOInputs inputs ) {
3346
Original file line number Diff line number Diff line change 44
55import com .revrobotics .spark .SparkBase .PersistMode ;
66import com .revrobotics .spark .SparkBase .ResetMode ;
7+ import com .revrobotics .RelativeEncoder ;
78import com .revrobotics .spark .SparkFlex ;
89import com .revrobotics .spark .SparkLowLevel .MotorType ;
910import com .revrobotics .spark .config .SparkFlexConfig ;
@@ -15,7 +16,10 @@ public class ElevatorIOVortex implements ElevatorIO {
1516 private final LoggedNetworkBoolean manual = new LoggedNetworkBoolean ("Manual Elevator" , false );
1617
1718 protected final SparkFlex leadMotor = new SparkFlex (ElevatorConstants .LEADER_CAN , MotorType .kBrushless );
18- private final SparkFlex followerMotor = new SparkFlex (ElevatorConstants .FOLLOWER_CAN , MotorType .kBrushless );
19+ protected final SparkFlex followerMotor = new SparkFlex (ElevatorConstants .FOLLOWER_CAN , MotorType .kBrushless );
20+
21+ protected final RelativeEncoder leadEncoder = this .leadMotor .getEncoder ();
22+ protected final RelativeEncoder followerEncoder = this .followerMotor .getEncoder ();
1923
2024 protected final LaserCanWrapper laserCan = new LaserCanWrapper (ElevatorConstants .LASER_CAN );
2125
Original file line number Diff line number Diff line change 22
33import com .revrobotics .sim .SparkFlexSim ;
44import com .revrobotics .sim .SparkLimitSwitchSim ;
5+ import com .revrobotics .sim .SparkRelativeEncoderSim ;
56
67import edu .wpi .first .math .system .plant .DCMotor ;
78import edu .wpi .first .math .system .plant .LinearSystemId ;
@@ -18,6 +19,10 @@ public class EndEffectorIOSim extends EndEffectorIOVortex {
1819 private final SparkFlexSim algaeIntakeMotor = new SparkFlexSim (super .algaeIntakeMotor , DCMotor .getNeoVortex (1 ));
1920 private final SparkFlexSim algaeWristMotor = new SparkFlexSim (super .algaeWristMotor , DCMotor .getNeoVortex (1 ));
2021
22+ private final SparkRelativeEncoderSim coralIntakeEncoder = new SparkRelativeEncoderSim (super .coralIntakeMotor );
23+ private final SparkRelativeEncoderSim algaeIntakeEncoder = new SparkRelativeEncoderSim (super .algaeIntakeMotor );
24+ private final SparkRelativeEncoderSim algaeWristEncoder = new SparkRelativeEncoderSim (super .algaeWristMotor );
25+
2126 private final SparkLimitSwitchSim coralBeambreak = this .coralIntakeMotor .getForwardLimitSwitchSim ();
2227
2328 private final FlywheelSim coralIntake = new FlywheelSim (
@@ -53,6 +58,15 @@ public class EndEffectorIOSim extends EndEffectorIOVortex {
5358 Units .degreesToRadians (90.0 )
5459 );
5560
61+ public EndEffectorIOSim () {
62+
63+ super ();
64+
65+ this .coralIntakeEncoder .setPosition (super .coralIntakeEncoder .getPosition ());
66+ this .algaeIntakeEncoder .setPosition (super .algaeIntakeEncoder .getPosition ());
67+ this .algaeWristEncoder .setPosition (super .algaeWristEncoder .getPosition ());
68+ }
69+
5670 @ Override
5771 public void updateInputs (EndEffectorIOInputs inputs ) {
5872
Original file line number Diff line number Diff line change 44
55import com .revrobotics .spark .SparkBase .PersistMode ;
66import com .revrobotics .spark .SparkBase .ResetMode ;
7+ import com .revrobotics .RelativeEncoder ;
78import com .revrobotics .spark .SparkFlex ;
89import com .revrobotics .spark .SparkLimitSwitch ;
910import com .revrobotics .spark .SparkLowLevel .MotorType ;
@@ -18,6 +19,10 @@ public class EndEffectorIOVortex implements EndEffectorIO {
1819 protected final SparkFlex algaeIntakeMotor = new SparkFlex (EndEffectorConstants .ALGAE_INTAKE_CAN , MotorType .kBrushless );
1920 protected final SparkFlex algaeWristMotor = new SparkFlex (EndEffectorConstants .ALGAE_WRIST_CAN , MotorType .kBrushless );
2021
22+ protected final RelativeEncoder coralIntakeEncoder = this .coralIntakeMotor .getEncoder ();
23+ protected final RelativeEncoder algaeIntakeEncoder = this .algaeIntakeMotor .getEncoder ();
24+ protected final RelativeEncoder algaeWristEncoder = this .algaeWristMotor .getEncoder ();
25+
2126 private final SparkLimitSwitch coralBeambreak = coralIntakeMotor .getForwardLimitSwitch ();
2227
2328 public EndEffectorIOVortex () {
Original file line number Diff line number Diff line change 11package frc .robot .subsystems .funnel ;
22
33import com .revrobotics .sim .SparkFlexSim ;
4+ import com .revrobotics .sim .SparkRelativeEncoderSim ;
45
56import edu .wpi .first .math .system .plant .DCMotor ;
67import edu .wpi .first .math .system .plant .LinearSystemId ;
1112public class FunnelIOSim extends FunnelIOVortex {
1213
1314 private final SparkFlexSim motor = new SparkFlexSim (super .motor , DCMotor .getNeoVortex (1 ));
15+ private final SparkRelativeEncoderSim encoder = new SparkRelativeEncoderSim (super .motor );
1416
1517 private final FlywheelSim funnel = new FlywheelSim (
1618 LinearSystemId .createFlywheelSystem (
@@ -21,6 +23,13 @@ public class FunnelIOSim extends FunnelIOVortex {
2123 DCMotor .getNeoVortex (1 )
2224 );
2325
26+ public FunnelIOSim () {
27+
28+ super ();
29+
30+ this .encoder .setPosition (super .encoder .getPosition ());
31+ }
32+
2433 @ Override
2534 public void updateInputs (FunnelIOInputsAutoLogged inputs ) {
2635
Original file line number Diff line number Diff line change 22
33import com .revrobotics .spark .SparkBase .PersistMode ;
44import com .revrobotics .spark .SparkBase .ResetMode ;
5+ import com .revrobotics .RelativeEncoder ;
56import com .revrobotics .spark .SparkFlex ;
67import com .revrobotics .spark .SparkLowLevel .MotorType ;
78import com .revrobotics .spark .config .SparkFlexConfig ;
89
910public class FunnelIOVortex implements FunnelIO {
1011
1112 protected final SparkFlex motor = new SparkFlex (FunnelConstants .FUNNEL_CAN , MotorType .kBrushless );
13+ protected final RelativeEncoder encoder = this .motor .getEncoder ();
1214
1315 public FunnelIOVortex () {
1416
Original file line number Diff line number Diff line change @@ -7,12 +7,12 @@ public final class BuildConstants {
77 public static final String MAVEN_GROUP = "" ;
88 public static final String MAVEN_NAME = "Reefscape2025" ;
99 public static final String VERSION = "unspecified" ;
10- public static final int GIT_REVISION = 334 ;
11- public static final String GIT_SHA = "22b98747ede7c39096c463f5e3bf606ab8be986c " ;
12- public static final String GIT_DATE = "2025-05-29 04:52:43 CDT" ;
13- public static final String GIT_BRANCH = "only_simulation " ;
14- public static final String BUILD_DATE = "2025-05-29 05:24:24 CDT" ;
15- public static final long BUILD_UNIX_TIME = 1748514264943L ;
10+ public static final int GIT_REVISION = 335 ;
11+ public static final String GIT_SHA = "91697717636e46c4344ce62e0bcf68fc2d0420e4 " ;
12+ public static final String GIT_DATE = "2025-05-29 05:30:37 CDT" ;
13+ public static final String GIT_BRANCH = "simulation " ;
14+ public static final String BUILD_DATE = "2025-07-16 12:01:56 CDT" ;
15+ public static final long BUILD_UNIX_TIME = 1752685316081L ;
1616 public static final int DIRTY = 1 ;
1717
1818 private BuildConstants (){}
You can’t perform that action at this time.
0 commit comments