1818import edu .wpi .first .wpilibj2 .command .button .CommandXboxController ;
1919import frc .lib .subsystems .TalonFXIO ;
2020import frc .lib .subsystems .canDevice .CanCoderIOHardware ;
21+ import frc .lib .subsystems .canDevice .CanRangeIOHardware ;
2122import frc .lib .subsystems .simulation .SimCanCoderIO ;
23+ import frc .lib .subsystems .simulation .SimCanRangeIO ;
24+ import frc .lib .subsystems .simulation .SimCanRangeIO .SimCanRangeState ;
2225import frc .lib .subsystems .simulation .SimElevator ;
2326import frc .lib .subsystems .simulation .SimTalonFXWithCancoder ;
2427import frc .robot .Constants .ElevatorConstants .Elevator2Constants ;
4447import frc .robot .subsystems .drive .DriveSubsystem ;
4548import frc .robot .subsystems .elevator .Elevator ;
4649import frc .robot .subsystems .end_effector .Claw ;
47- import frc .robot .subsystems .end_effector .ClawIO ;
48- import frc .robot .subsystems .end_effector .ClawIOReal ;
49- import frc .robot .subsystems .end_effector .ClawIOSim ;
50- import frc .robot .subsystems .end_effector .ClawOld ;
5150import frc .robot .subsystems .end_effector .EndEffector ;
5251import frc .robot .subsystems .feeder .Feeder ;
5352import frc .robot .subsystems .feeder .FeederIO ;
@@ -110,6 +109,9 @@ public void accept(VisionFieldPoseEstimate estimate) {
110109 // private NamedCommandsSetup namedCommands;
111110 private AutoChooserSetup autoChooserSetup ;
112111
112+ SimCanRangeState clawSimRange1 = new SimCanRangeState ();
113+ SimCanRangeState clawSimRange2 = new SimCanRangeState ();
114+
113115 /** The container for the robot. Contains subsystems, OI devices, and commands. */
114116 public RobotContainer () {
115117 elevator = buildElevator2 ();
@@ -128,7 +130,13 @@ public RobotContainer() {
128130 new TalonFXIO (EndEffectorConstants2 .kEndEffectorConfig ),
129131 new CanCoderIOHardware (EndEffectorConstants2 .kEndEffectorConfig .canCoderConfig ),
130132 robotState );
131- claw = new Claw (new ClawIOReal () {});
133+ claw =
134+ new Claw (
135+ EndEffectorConstants2 .kClawConfig ,
136+ new TalonFXIO (EndEffectorConstants2 .kClawConfig ),
137+ robotState ,
138+ new CanRangeIOHardware (EndEffectorConstants2 .kCanRangeConfig ),
139+ new CanRangeIOHardware (EndEffectorConstants2 .kCanRangeConfig2 ));
132140 // elevator = new ElevatorOld(new ElevatorIOReal());
133141 superstructure = new Superstructure (elevator , endEffector , this );
134142 climber = new Climber (new ClimberIOReal ());
@@ -158,7 +166,13 @@ public RobotContainer() {
158166 EndEffectorConstants2 .kEndEffectorConfig )),
159167 robotState );
160168 // elevator = new ElevatorOld(new ElevatorIOSim());
161- claw = new Claw (new ClawIOSim () {});
169+ claw =
170+ new Claw (
171+ EndEffectorConstants2 .kClawConfig ,
172+ simulatedEndEffectorMotor ,
173+ robotState ,
174+ new SimCanRangeIO (EndEffectorConstants2 .kCanRangeConfig , () -> clawSimRange1 ),
175+ new SimCanRangeIO (EndEffectorConstants2 .kCanRangeConfig2 , () -> clawSimRange2 ));
162176 superstructure = new Superstructure (elevator , endEffector , this );
163177 climber = new Climber (new ClimberIOSim ());
164178 climbRoller = new ClimbRoller (new ClimbRollerIOSim ());
@@ -186,7 +200,13 @@ public RobotContainer() {
186200 simulatedEndEffectorMotor .getSupplierForCancoder (
187201 EndEffectorConstants2 .kEndEffectorConfig )),
188202 robotState );
189- claw = new Claw (new ClawIO () {});
203+ claw =
204+ new Claw (
205+ EndEffectorConstants2 .kClawConfig ,
206+ new TalonFXIO (EndEffectorConstants2 .kClawConfig ),
207+ robotState ,
208+ new CanRangeIOHardware (EndEffectorConstants2 .kCanRangeConfig ),
209+ new CanRangeIOHardware (EndEffectorConstants2 .kCanRangeConfig2 ));
190210 // elevator = new ElevatorOld(new ElevatorIO() {});
191211 superstructure = new Superstructure (elevator , endEffector , this );
192212 climber = new Climber (new ClimberIO () {});
@@ -313,4 +333,14 @@ public Led getLed() {
313333 public RobotState getRobotState () {
314334 return robotState ;
315335 }
336+
337+ public void setSimCanRange1 (boolean tripped , double distanceMeters ) {
338+ clawSimRange1 .isTripped = tripped ;
339+ clawSimRange1 .distanceMeters = distanceMeters ;
340+ }
341+
342+ public void setSimCanRange2 (boolean tripped , double distanceMeters ) {
343+ clawSimRange2 .isTripped = tripped ;
344+ clawSimRange2 .distanceMeters = distanceMeters ;
345+ }
316346}
0 commit comments