1515import edu .wpi .first .units .measure .Angle ;
1616import edu .wpi .first .units .measure .Distance ;
1717import edu .wpi .first .wpilibj2 .command .SubsystemBase ;
18+ import frc .robot .subsystems .brain .GamePiece ;
1819
1920public class Mechanism3d extends SubsystemBase {
2021
@@ -40,8 +41,7 @@ public class Mechanism3d extends SubsystemBase {
4041 private final Supplier <Distance > elevatorHeightSupplier_ ;
4142 private final Supplier <Angle > armAngleSupplier_ ;
4243 private final Supplier <Angle > climberAngleSupplier_ ;
43- private final Supplier <Boolean > hasAlgaeSupplier_ ;
44- private final Supplier <Boolean > hasCoralSupplier_ ;
44+ private final Supplier <GamePiece > gpSupplier_ ;
4545
4646 private Pose2d robotPose_ = new Pose2d ();
4747 private Distance elevatorHeight_ = Meters .zero ();
@@ -54,16 +54,14 @@ public Mechanism3d(
5454 Supplier <Distance > elevatorHeight ,
5555 Supplier <Angle > armAngle ,
5656 Supplier <Angle > climberAngle ,
57- Supplier <Boolean > hasAlgae ,
58- Supplier <Boolean > hasCoral
57+ Supplier <GamePiece > gamePiece
5958 ) {
6059 key_ = key ;
6160 robotPoseSupplier_ = robotPose ;
6261 elevatorHeightSupplier_ = elevatorHeight ;
6362 armAngleSupplier_ = armAngle ;
6463 climberAngleSupplier_ = climberAngle ;
65- hasAlgaeSupplier_ = hasAlgae ;
66- hasCoralSupplier_ = hasCoral ;
64+ gpSupplier_ = gamePiece ;
6765 }
6866
6967 @ Override
@@ -90,11 +88,11 @@ public void periodic() {
9088 new Rotation3d (climberAngle_ .unaryMinus (), Degrees .zero (), Degrees .zero ())
9189 );
9290
93- Logger .recordOutput ("Gamepiece3d/Algae/" + key_ , hasAlgaeSupplier_ .get () ?
91+ Logger .recordOutput ("Gamepiece3d/Algae/" + key_ , gpSupplier_ .get () == GamePiece . ALGAE_HIGH ?
9492 new Pose3d [] { robotToField (arm .plus (armToAlgae )) } : new Pose3d [0 ]
9593 );
9694
97- Logger .recordOutput ("Gamepiece3d/Coral/" + key_ , hasCoralSupplier_ .get () ?
95+ Logger .recordOutput ("Gamepiece3d/Coral/" + key_ , gpSupplier_ .get () == GamePiece . CORAL ?
9896 new Pose3d [] { robotToField (arm .transformBy (armToCoral )) } : new Pose3d [0 ]
9997 );
10098
0 commit comments