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
16
import org .team1540 .robot2024 .subsystems .tramp .Tramp ;
17
17
import org .team1540 .robot2024 .subsystems .tramp .TrampIO ;
18
18
import org .team1540 .robot2024 .subsystems .tramp .TrampIOSim ;
19
19
import org .team1540 .robot2024 .subsystems .tramp .TrampIOSparkMax ;
20
+ import org .team1540 .robot2024 .subsystems .shooter .*;
20
21
import org .team1540 .robot2024 .util .swerve .SwerveFactory ;
21
22
import org .littletonrobotics .junction .networktables .LoggedDashboardChooser ;
22
23
@@ -32,6 +33,7 @@ public class RobotContainer {
32
33
// Subsystems
33
34
public final Drivetrain drivetrain ;
34
35
public final Tramp tramp ;
36
+ public final Shooter shooter ;
35
37
36
38
// Controller
37
39
public final CommandXboxController driver = new CommandXboxController (0 );
@@ -40,6 +42,10 @@ public class RobotContainer {
40
42
// Dashboard inputs
41
43
public final LoggedDashboardChooser <Command > autoChooser ;
42
44
45
+ // TODO: testing dashboard inputs, remove for comp
46
+ public final LoggedDashboardNumber leftFlywheelSetpoint = new LoggedDashboardNumber ("Shooter/Flywheels/leftSetpoint" , 6000 );
47
+ public final LoggedDashboardNumber rightFlywheelSetpoint = new LoggedDashboardNumber ("Shooter/Flywheels/rightSetpoint" , 6000 );
48
+
43
49
/**
44
50
* The container for the robot. Contains subsystems, OI devices, and commands.
45
51
*/
@@ -55,6 +61,7 @@ public RobotContainer() {
55
61
new ModuleIOTalonFX (SwerveFactory .getModuleMotors (SwerveConfig .BACK_LEFT , SwerveFactory .SwerveCorner .BACK_LEFT )),
56
62
new ModuleIOTalonFX (SwerveFactory .getModuleMotors (SwerveConfig .BACK_RIGHT , SwerveFactory .SwerveCorner .BACK_RIGHT )));
57
63
tramp = new Tramp (new TrampIOSparkMax ());
64
+ shooter = new Shooter (new ShooterPivotIOTalonFX (), new FlywheelsIOTalonFX ());
58
65
break ;
59
66
case SIM :
60
67
// Sim robot, instantiate physics sim IO implementations
@@ -66,22 +73,19 @@ public RobotContainer() {
66
73
new ModuleIOSim (),
67
74
new ModuleIOSim ());
68
75
tramp = new Tramp (new TrampIOSim ());
76
+ shooter = new Shooter (new ShooterPivotIOSim (), new FlywheelsIOSim ());
69
77
break ;
70
78
71
79
default :
72
80
// Replayed robot, disable IO implementations
73
81
drivetrain =
74
82
new Drivetrain (
75
- new GyroIO () {
76
- },
77
- new ModuleIO () {
78
- },
79
- new ModuleIO () {
80
- },
81
- new ModuleIO () {
82
- },
83
- new ModuleIO () {
84
- });
83
+ new GyroIO () {},
84
+ new ModuleIO () {},
85
+ new ModuleIO () {},
86
+ new ModuleIO () {},
87
+ new ModuleIO () {});
88
+ shooter = new Shooter (new ShooterPivotIO () {}, new FlywheelsIO () {});
85
89
tramp = new Tramp (new TrampIO () {});
86
90
break ;
87
91
}
@@ -95,6 +99,10 @@ public RobotContainer() {
95
99
"Drive FF Characterization" ,
96
100
new FeedForwardCharacterization (
97
101
drivetrain , drivetrain ::runCharacterizationVolts , drivetrain ::getCharacterizationVelocity ));
102
+ autoChooser .addOption (
103
+ "Flywheels FF Characterization" ,
104
+ new FeedForwardCharacterization (
105
+ shooter , volts -> shooter .setFlywheelVolts (volts , volts ), () -> shooter .getLeftFlywheelSpeed () / 60 ));
98
106
99
107
// Configure the button bindings
100
108
configureButtonBindings ();
@@ -115,6 +123,9 @@ private void configureButtonBindings() {
115
123
drivetrain
116
124
).ignoringDisable (true )
117
125
);
126
+
127
+ copilot .a ().onTrue (shooter .spinUpCommand (leftFlywheelSetpoint .get (), rightFlywheelSetpoint .get ()))
128
+ .onFalse (Commands .runOnce (shooter ::stopFlywheels , shooter ));
118
129
}
119
130
120
131
/**
0 commit comments