9
9
import edu .wpi .first .wpilibj2 .command .Commands ;
10
10
import edu .wpi .first .wpilibj2 .command .button .CommandXboxController ;
11
11
12
-
12
+ import org . littletonrobotics . junction . networktables . LoggedDashboardNumber ;
13
13
import org .team1540 .robot2024 .commands .FeedForwardCharacterization ;
14
14
import org .team1540 .robot2024 .commands .SwerveDriveCommand ;
15
15
import org .team1540 .robot2024 .subsystems .drive .*;
16
+ import org .team1540 .robot2024 .subsystems .shooter .*;
16
17
import org .team1540 .robot2024 .util .swerve .SwerveFactory ;
17
18
import org .littletonrobotics .junction .networktables .LoggedDashboardChooser ;
18
19
27
28
public class RobotContainer {
28
29
// Subsystems
29
30
public final Drivetrain drivetrain ;
31
+ public final Shooter shooter ;
30
32
31
33
// Controller
32
34
public final CommandXboxController driver = new CommandXboxController (0 );
@@ -35,6 +37,10 @@ public class RobotContainer {
35
37
// Dashboard inputs
36
38
public final LoggedDashboardChooser <Command > autoChooser ;
37
39
40
+ // TODO: testing dashboard inputs, remove for comp
41
+ public final LoggedDashboardNumber leftFlywheelSetpoint = new LoggedDashboardNumber ("Shooter/Flywheels/leftSetpoint" , 6000 );
42
+ public final LoggedDashboardNumber rightFlywheelSetpoint = new LoggedDashboardNumber ("Shooter/Flywheels/rightSetpoint" , 6000 );
43
+
38
44
/**
39
45
* The container for the robot. Contains subsystems, OI devices, and commands.
40
46
*/
@@ -49,6 +55,7 @@ public RobotContainer() {
49
55
new ModuleIOTalonFX (SwerveFactory .getModuleMotors (SwerveConfig .FRONT_RIGHT , SwerveFactory .SwerveCorner .FRONT_RIGHT )),
50
56
new ModuleIOTalonFX (SwerveFactory .getModuleMotors (SwerveConfig .BACK_LEFT , SwerveFactory .SwerveCorner .BACK_LEFT )),
51
57
new ModuleIOTalonFX (SwerveFactory .getModuleMotors (SwerveConfig .BACK_RIGHT , SwerveFactory .SwerveCorner .BACK_RIGHT )));
58
+ shooter = new Shooter (new ShooterPivotIOTalonFX (), new FlywheelsIOTalonFX ());
52
59
break ;
53
60
54
61
case SIM :
@@ -60,22 +67,19 @@ public RobotContainer() {
60
67
new ModuleIOSim (),
61
68
new ModuleIOSim (),
62
69
new ModuleIOSim ());
70
+ shooter = new Shooter (new ShooterPivotIOSim (), new FlywheelsIOSim ());
63
71
break ;
64
72
65
73
default :
66
74
// Replayed robot, disable IO implementations
67
75
drivetrain =
68
76
new Drivetrain (
69
- new GyroIO () {
70
- },
71
- new ModuleIO () {
72
- },
73
- new ModuleIO () {
74
- },
75
- new ModuleIO () {
76
- },
77
- new ModuleIO () {
78
- });
77
+ new GyroIO () {},
78
+ new ModuleIO () {},
79
+ new ModuleIO () {},
80
+ new ModuleIO () {},
81
+ new ModuleIO () {});
82
+ shooter = new Shooter (new ShooterPivotIO () {}, new FlywheelsIO () {});
79
83
break ;
80
84
}
81
85
@@ -88,6 +92,10 @@ public RobotContainer() {
88
92
"Drive FF Characterization" ,
89
93
new FeedForwardCharacterization (
90
94
drivetrain , drivetrain ::runCharacterizationVolts , drivetrain ::getCharacterizationVelocity ));
95
+ autoChooser .addOption (
96
+ "Flywheels FF Characterization" ,
97
+ new FeedForwardCharacterization (
98
+ shooter , volts -> shooter .setFlywheelVolts (volts , volts ), () -> shooter .getLeftFlywheelSpeed () / 60 ));
91
99
92
100
// Configure the button bindings
93
101
configureButtonBindings ();
@@ -108,6 +116,9 @@ private void configureButtonBindings() {
108
116
drivetrain
109
117
).ignoringDisable (true )
110
118
);
119
+
120
+ copilot .a ().onTrue (shooter .spinUpCommand (leftFlywheelSetpoint .get (), rightFlywheelSetpoint .get ()))
121
+ .onFalse (Commands .runOnce (shooter ::stopFlywheels , shooter ));
111
122
}
112
123
113
124
/**
0 commit comments