77
88package first .robot ;
99
10- import static org .wpilib .units .Units .*;
10+ import static org .wpilib .units .Units .FeetPerSecond ;
11+ import static org .wpilib .units .Units .MetersPerSecond ;
12+ import static org .wpilib .units .Units .RadiansPerSecond ;
13+ import static org .wpilib .units .Units .Volts ;
1114
15+ import com .ctre .phoenix6 .CANBus ;
1216import first .generated .CompTunerConstants ;
1317import first .robot .Constants .DriveConstants ;
1418import first .robot .commands .drive .DriveCommands ;
1721import first .robot .subsystems .drive .GyroIOPigeon2 ;
1822import first .robot .subsystems .drive .ModuleIOReplay ;
1923import first .robot .subsystems .drive .ModuleIOTalonFX ;
24+ import first .robot .subsystems .motor .Motor ;
25+ import first .robot .subsystems .motor .MotorIO ;
26+ import first .robot .subsystems .motor .MotorIOHardware ;
27+ import first .robot .subsystems .vision .AprilTagVision ;
28+ import first .robot .subsystems .vision .CameraIO ;
29+ import first .robot .subsystems .vision .CameraIOLimelight ;
2030import org .wpilib .command2 .Command ;
2131import org .wpilib .command2 .Commands ;
2232import org .wpilib .command2 .button .CommandXboxController ;
33+ import org .wpilib .hardware .bus .CANPort ;
2334
2435public class RobotContainer {
2536
2637 private Drive drive ;
38+ private AprilTagVision vision ;
39+ private Motor motor ;
2740
2841 private final CommandXboxController gamepad = new CommandXboxController (0 );
2942
@@ -41,6 +54,13 @@ public RobotContainer() {
4154 CompTunerConstants .BackRight ,
4255 CompTunerConstants .kCANBus ,
4356 CompTunerConstants .kSpeedAt12Volts );
57+
58+ motor = new Motor (new MotorIOHardware (4 , new CANBus (CANPort .CAN_S4 )));
59+
60+ vision =
61+ new AprilTagVision (
62+ drive ::addVisionMeasurement ,
63+ new CameraIOLimelight ("limelight" , drive ::getRotation ));
4464 break ;
4565 case SIMBOT :
4666 drive =
@@ -69,6 +89,14 @@ public RobotContainer() {
6989 CompTunerConstants .kSpeedAt12Volts );
7090 }
7191
92+ if (motor == null ) {
93+ motor = new Motor (new MotorIO () {});
94+ }
95+
96+ if (vision == null ) {
97+ vision = new AprilTagVision (drive ::addVisionMeasurement , new CameraIO () {});
98+ }
99+
72100 DriveCommands .configure (
73101 drive , () -> -gamepad .getLeftY (), () -> -gamepad .getLeftX (), () -> -gamepad .getRightX ());
74102
@@ -77,7 +105,9 @@ public RobotContainer() {
77105 }
78106
79107 // Bind robot actions to commands here.
80- private void configureBindings () {}
108+ private void configureBindings () {
109+ gamepad .rightTrigger ().and (gamepad .leftTrigger ()).whileTrue (motor .runVoltage (Volts .of (6.0 )));
110+ }
81111
82112 private void configureDriveBindings () {
83113 // Default command, normal field-relative drive
0 commit comments