44import static edu .wpi .first .units .Units .Meters ;
55import static edu .wpi .first .units .Units .MetersPerSecond ;
66
7- import org .ironmaple .simulation .SimulatedArena ;
8- import org .ironmaple .simulation .seasonspecific .reefscape2025 .ReefscapeCoralOnFly ;
9-
7+ import edu .wpi .first .math .geometry .Pose2d ;
8+ import edu .wpi .first .math .geometry .Rotation2d ;
109import edu .wpi .first .math .geometry .Translation2d ;
1110import edu .wpi .first .wpilibj2 .command .Commands ;
11+ import edu .wpi .first .wpilibj2 .command .InstantCommand ;
1212import edu .wpi .first .wpilibj2 .command .button .CommandXboxController ;
13+ import org .ironmaple .simulation .SimulatedArena ;
14+ import org .ironmaple .simulation .seasonspecific .reefscape2025 .ReefscapeCoralOnFly ;
1315import team5427 .frc .robot .Constants ;
1416import team5427 .frc .robot .Constants .DriverConstants ;
1517import team5427 .frc .robot .commands .chassis .ChassisMovement ;
1618import team5427 .frc .robot .subsystems .Swerve .SwerveSubsystem ;
19+ import team5427 .frc .robot .subsystems .vision .QuestNav ;
1720
1821public class PilotingControls {
1922 private CommandXboxController joy ;
@@ -31,29 +34,64 @@ public PilotingControls(CommandXboxController joy) {
3134 /** Made private to prevent multiple calls to this method */
3235 private void initalizeTriggers () {
3336 SwerveSubsystem .getInstance ().setDefaultCommand (new ChassisMovement (joy ));
37+ joy .a ()
38+ .onTrue (
39+ new InstantCommand (
40+ () ->
41+ QuestNav .getInstance ()
42+ .setPose (new Pose2d (10 * Math .random (), 4 , Rotation2d .kZero )))
43+ .ignoringDisable (true ));
44+ joy .x ().onTrue (new InstantCommand (() -> {}));
45+
3446 // Example Coral Placement Code
35- // TODO: delete these code for your own project
36- if (Constants .currentMode == Constants .Mode .SIM ) {
37- // L4 placement
38- joy .y ().onTrue (Commands .runOnce (() -> SimulatedArena .getInstance ()
39- .addGamePieceProjectile (new ReefscapeCoralOnFly (
40- SwerveSubsystem .getInstance ().getKDriveSimulation ().getSimulatedDriveTrainPose ().getTranslation (),
41- new Translation2d (0.4 , 0 ),
42- SwerveSubsystem .getInstance ().getKDriveSimulation ().getDriveTrainSimulatedChassisSpeedsFieldRelative (),
43- SwerveSubsystem .getInstance ().getKDriveSimulation ().getSimulatedDriveTrainPose ().getRotation (),
44- Meters .of (2 ),
45- MetersPerSecond .of (1.5 ),
46- Degrees .of (-80 )))));
47- // L3 placement
48- joy .b ().onTrue (Commands .runOnce (() -> SimulatedArena .getInstance ()
49- .addGamePieceProjectile (new ReefscapeCoralOnFly (
50- SwerveSubsystem .getInstance ().getKDriveSimulation ().getSimulatedDriveTrainPose ().getTranslation (),
51- new Translation2d (0.4 , 0 ),
52- SwerveSubsystem .getInstance ().getKDriveSimulation ().getDriveTrainSimulatedChassisSpeedsFieldRelative (),
53- SwerveSubsystem .getInstance ().getKDriveSimulation ().getSimulatedDriveTrainPose ().getRotation (),
54- Meters .of (1.35 ),
55- MetersPerSecond .of (1.5 ),
56- Degrees .of (-60 )))));
57- }
47+ // TODO: delete these code for your own project
48+ if (Constants .currentMode == Constants .Mode .SIM ) {
49+ // L4 placement
50+ joy .y ()
51+ .onTrue (
52+ Commands .runOnce (
53+ () ->
54+ SimulatedArena .getInstance ()
55+ .addGamePieceProjectile (
56+ new ReefscapeCoralOnFly (
57+ SwerveSubsystem .getInstance ()
58+ .getKDriveSimulation ()
59+ .getSimulatedDriveTrainPose ()
60+ .getTranslation (),
61+ new Translation2d (0.4 , 0 ),
62+ SwerveSubsystem .getInstance ()
63+ .getKDriveSimulation ()
64+ .getDriveTrainSimulatedChassisSpeedsFieldRelative (),
65+ SwerveSubsystem .getInstance ()
66+ .getKDriveSimulation ()
67+ .getSimulatedDriveTrainPose ()
68+ .getRotation (),
69+ Meters .of (2 ),
70+ MetersPerSecond .of (1.5 ),
71+ Degrees .of (-80 )))));
72+ // L3 placement
73+ joy .b ()
74+ .onTrue (
75+ Commands .runOnce (
76+ () ->
77+ SimulatedArena .getInstance ()
78+ .addGamePieceProjectile (
79+ new ReefscapeCoralOnFly (
80+ SwerveSubsystem .getInstance ()
81+ .getKDriveSimulation ()
82+ .getSimulatedDriveTrainPose ()
83+ .getTranslation (),
84+ new Translation2d (0.4 , 0 ),
85+ SwerveSubsystem .getInstance ()
86+ .getKDriveSimulation ()
87+ .getDriveTrainSimulatedChassisSpeedsFieldRelative (),
88+ SwerveSubsystem .getInstance ()
89+ .getKDriveSimulation ()
90+ .getSimulatedDriveTrainPose ()
91+ .getRotation (),
92+ Meters .of (1.35 ),
93+ MetersPerSecond .of (1.5 ),
94+ Degrees .of (-60 )))));
95+ }
5896 }
5997}
0 commit comments