@@ -2,10 +2,10 @@ package com.team4099.robot2026
22
33import com.ctre.phoenix6.signals.NeutralModeValue
44import com.team4099.robot2026.auto.AutonomousSelector
5+ import com.team4099.robot2026.commands.AgitateIntakeCommand
56import com.team4099.robot2026.commands.drivetrain.AimOTFCommand
67import com.team4099.robot2026.commands.drivetrain.DrivePathOTF
78import com.team4099.robot2026.commands.drivetrain.ResetGyroYawCommand
8- import com.team4099.robot2026.commands.drivetrain.TargetAngleCommand
99import com.team4099.robot2026.commands.drivetrain.TeleopDriveCommand
1010import com.team4099.robot2026.config.ControlBoard
1111import com.team4099.robot2026.config.constants.Constants
@@ -36,6 +36,7 @@ import com.team4099.robot2026.subsystems.superstructure.hopper.HopperIOTalon
3636import com.team4099.robot2026.subsystems.superstructure.intake.Intake
3737import com.team4099.robot2026.subsystems.superstructure.intake.IntakeIO
3838import com.team4099.robot2026.subsystems.superstructure.intake.IntakeIOSim
39+ import com.team4099.robot2026.subsystems.superstructure.intake.IntakeIOTalon
3940import com.team4099.robot2026.subsystems.superstructure.intake.rollers.IntakeRollers
4041import com.team4099.robot2026.subsystems.superstructure.intake.rollers.IntakeRollersIO
4142import com.team4099.robot2026.subsystems.superstructure.intake.rollers.IntakeRollersIOSim
@@ -47,7 +48,6 @@ import com.team4099.robot2026.subsystems.superstructure.shooter.ShooterIOTalon
4748import com.team4099.robot2026.subsystems.vision.Vision
4849import com.team4099.robot2026.subsystems.vision.camera.CameraIOPVSim
4950import com.team4099.robot2026.subsystems.vision.camera.CameraIOPhotonvision
50- import com.team4099.robot2026.util.AllianceFlipUtil
5151import com.team4099.robot2026.util.driver.Jessika
5252import edu.wpi.first.wpilibj.RobotBase
5353import edu.wpi.first.wpilibj2.command.Commands
@@ -117,13 +117,14 @@ object RobotContainer {
117117 climb = Climb (object : ClimbIO {})
118118 feeder = Feeder (FeederIOTalonFX )
119119 hopper = Hopper (HopperIOTalon )
120- intake = Intake (object : IntakeIO {} )
120+ intake = Intake (IntakeIOTalon )
121121 intakeRollers = IntakeRollers (IntakeRollersIOTalon )
122122 shooter = Shooter (ShooterIOTalon )
123123 leds =
124124 Leds (
125125 { isAligning },
126126 { Superstructure .Companion .SuperstructureStates .UNINITALIZED },
127+ { false },
127128 LedIOCandle (Constants .LEDS .CANDLE_ID ))
128129 }
129130 Constants .WHOAMI .TESTBOT -> {
@@ -138,6 +139,7 @@ object RobotContainer {
138139 Leds (
139140 { isAligning },
140141 { Superstructure .Companion .SuperstructureStates .UNINITALIZED },
142+ { false },
141143 object : LedIO {})
142144 }
143145 }
@@ -180,13 +182,15 @@ object RobotContainer {
180182 Leds (
181183 { isAligning },
182184 { Superstructure .Companion .SuperstructureStates .UNINITALIZED },
185+ { false },
183186 object : LedIO {})
184187 }
185188
186189 superstructure =
187190 Superstructure (drivetrain, vision, climb, feeder, hopper, intake, intakeRollers, shooter)
188191
189192 leds.stateSupplier = { superstructure.currentState }
193+ leds.manualScoringSupplier = { superstructure.overrideShooterVelocity }
190194 }
191195
192196 fun mapDefaultCommands () {
@@ -210,8 +214,31 @@ object RobotContainer {
210214
211215 fun mapTeleopControls () {
212216 ControlBoard .resetGyro.whileTrue(ResetGyroYawCommand (drivetrain))
217+
213218 ControlBoard .forceHome.onTrue(superstructure.requestForceHomeCommand())
214- ControlBoard .unjam.onTrue(superstructure.requestUnjamCommand())
219+ ControlBoard .forceHome.onFalse(
220+ ConditionalCommand (
221+ superstructure.requestIntakeCommand(),
222+ superstructure.requestIdleCommand(),
223+ ) {
224+ ControlBoard .intake.asBoolean
225+ })
226+
227+ ControlBoard .unjam.onTrue(
228+ ConditionalCommand (superstructure.requestUnjamCommand(), InstantCommand ()) {
229+ superstructure.currentState == Superstructure .Companion .SuperstructureStates .PREP_SCORE ||
230+ superstructure.currentState ==
231+ Superstructure .Companion .SuperstructureStates .SCORE_AND_INTAKE ||
232+ superstructure.currentState == Superstructure .Companion .SuperstructureStates .SCORE
233+ })
234+
235+ ControlBoard .unjam.onFalse(
236+ ConditionalCommand (
237+ superstructure.requestScoreCommand(),
238+ InstantCommand (),
239+ ) {
240+ superstructure.currentState == Superstructure .Companion .SuperstructureStates .UNJAM
241+ })
215242
216243 ControlBoard .forceIdle.onTrue(superstructure.requestIdleCommand())
217244
@@ -242,61 +269,90 @@ object RobotContainer {
242269 // ControlBoard.climb.onTrue(superstructure.requestClimbCommand())
243270
244271 ControlBoard .intake.onTrue(superstructure.requestIntakeCommand())
245- ControlBoard .forceIntakeFullUp.whileTrue(
272+ ControlBoard .intake.onFalse(superstructure.requestIdleCommand())
273+ ControlBoard .forceIntakeUpTrigger.whileTrue(
246274 RepeatCommand (
247275 SequentialCommandGroup (
248276 Commands .runOnce({
249277 intakeOverridingAngle =
250- min(IntakeConstants .PIVOT_MAX_ANGLE , intakeOverridingAngle + 20 .degrees)
278+ min(
279+ IntakeConstants .PIVOT_MAX_ANGLE - 20 .degrees,
280+ intakeOverridingAngle + 40 .degrees)
251281 }),
252282 Commands .defer(
253283 { superstructure.requestForceIntakeCommand(intakeOverridingAngle) },
254284 setOf (superstructure)),
255285 WaitCommand (0.1 ))))
256- ControlBoard .forceIntakeFullDown.whileTrue(
286+ ControlBoard .forceIntakeUpShoulder.whileTrue(
287+ RepeatCommand (
288+ SequentialCommandGroup (
289+ Commands .runOnce({
290+ intakeOverridingAngle = IntakeConstants .PIVOT_MAX_ANGLE - 15 .degrees
291+ }),
292+ Commands .defer(
293+ { superstructure.requestForceIntakeCommand(intakeOverridingAngle) },
294+ setOf (superstructure)),
295+ WaitCommand (0.1 ))))
296+
297+ ControlBoard .forceIntakeDownTrigger.whileTrue(
257298 RepeatCommand (
258299 SequentialCommandGroup (
259300 Commands .runOnce({
260301 intakeOverridingAngle =
261- max(IntakeConstants .PIVOT_MIN_ANGLE , intakeOverridingAngle - 20 .degrees)
302+ max(
303+ IntakeConstants .PIVOT_MIN_ANGLE + 15 .degrees,
304+ intakeOverridingAngle - 40 .degrees)
262305 }),
263306 Commands .defer(
264307 { superstructure.requestForceIntakeCommand(intakeOverridingAngle) },
265308 setOf (superstructure)),
266309 WaitCommand (0.1 ))))
267310
268- ControlBoard .rotateTrench.whileTrue(
269- TargetAngleCommand (
270- Jessika (),
271- { ControlBoard .forward.smoothDeadband(Constants .Joysticks .THROTTLE_DEADBAND ) },
272- { ControlBoard .strafe.smoothDeadband(Constants .Joysticks .THROTTLE_DEADBAND ) },
273- { ControlBoard .turn.smoothDeadband(Constants .Joysticks .TURN_DEADBAND ) },
274- { ControlBoard .slowMode },
275- drivetrain,
276- {
277- if (FieldConstants .inTrenchAllianceZone(drivetrain.pose) &&
278- ! AllianceFlipUtil .shouldFlip() ||
279- ! FieldConstants .inTrenchAllianceZone(drivetrain.pose) &&
280- AllianceFlipUtil .shouldFlip())
281- 0 .degrees
282- else 180 .degrees
283- }))
284- ControlBoard .rotateBump.whileTrue(
285- TargetAngleCommand (
286- Jessika (),
287- { ControlBoard .forward.smoothDeadband(Constants .Joysticks .THROTTLE_DEADBAND ) },
288- { ControlBoard .strafe.smoothDeadband(Constants .Joysticks .THROTTLE_DEADBAND ) },
289- { ControlBoard .turn.smoothDeadband(Constants .Joysticks .TURN_DEADBAND ) },
290- { ControlBoard .slowMode },
291- drivetrain,
292- {
293- if (FieldConstants .inTrenchAllianceZone(drivetrain.pose) &&
294- ! AllianceFlipUtil .shouldFlip() ||
295- ! FieldConstants .inTrenchAllianceZone(drivetrain.pose) &&
296- AllianceFlipUtil .shouldFlip())
297- 45 .degrees
298- else 225 .degrees
299- }))
311+ ControlBoard .forceIntakeDownShoulder.whileTrue(
312+ RepeatCommand (
313+ SequentialCommandGroup (
314+ Commands .runOnce({
315+ intakeOverridingAngle = IntakeConstants .PIVOT_MIN_ANGLE + 5 .degrees
316+ }),
317+ Commands .defer(
318+ { superstructure.requestForceIntakeCommand(intakeOverridingAngle) },
319+ setOf (superstructure)),
320+ WaitCommand (0.1 ))))
321+
322+ ControlBoard .jiggle.whileTrue(AgitateIntakeCommand (superstructure, intake))
323+
324+ // ControlBoard.rotateTrench.whileTrue(
325+ // TargetAngleCommand(
326+ // Jessika(),
327+ // { ControlBoard.forward.smoothDeadband(Constants.Joysticks.THROTTLE_DEADBAND) },
328+ // { ControlBoard.strafe.smoothDeadband(Constants.Joysticks.THROTTLE_DEADBAND) },
329+ // { ControlBoard.turn.smoothDeadband(Constants.Joysticks.TURN_DEADBAND) },
330+ // { ControlBoard.slowMode },
331+ // drivetrain,
332+ // {
333+ // if (FieldConstants.inTrenchAllianceZone(drivetrain.pose) &&
334+ // !AllianceFlipUtil.shouldFlip() ||
335+ // !FieldConstants.inTrenchAllianceZone(drivetrain.pose) &&
336+ // AllianceFlipUtil.shouldFlip())
337+ // 0.degrees
338+ // else 180.degrees
339+ // }))
340+ // ControlBoard.rotateBump.whileTrue(
341+ // TargetAngleCommand(
342+ // Jessika(),
343+ // { ControlBoard.forward.smoothDeadband(Constants.Joysticks.THROTTLE_DEADBAND) },
344+ // { ControlBoard.strafe.smoothDeadband(Constants.Joysticks.THROTTLE_DEADBAND) },
345+ // { ControlBoard.turn.smoothDeadband(Constants.Joysticks.TURN_DEADBAND) },
346+ // { ControlBoard.slowMode },
347+ // drivetrain,
348+ // {
349+ // if (FieldConstants.inTrenchAllianceZone(drivetrain.pose) &&
350+ // !AllianceFlipUtil.shouldFlip() ||
351+ // !FieldConstants.inTrenchAllianceZone(drivetrain.pose) &&
352+ // AllianceFlipUtil.shouldFlip())
353+ // 45.degrees
354+ // else 225.degrees
355+ // }))
300356
301357 ControlBoard .score.whileTrue(
302358 ConditionalCommand (
@@ -328,11 +384,21 @@ object RobotContainer {
328384 FieldConstants .inTrenchAllianceZone(drivetrain.pose)
329385 })
330386
331- ControlBoard .climbOTF.whileTrue(
332- ConditionalCommand (
333- DrivePathOTF .alignClimbBottom(drivetrain), DrivePathOTF .alignClimbTop(drivetrain)) {
334- FieldConstants .inClimbLowerHalf(drivetrain.pose)
335- })
387+ // ControlBoard.climbOTF.whileTrue(
388+ // ConditionalCommand(
389+ // DrivePathOTF.alignClimbBottom(drivetrain), DrivePathOTF.alignClimbTop(drivetrain))
390+ // {
391+ // FieldConstants.inClimbLowerHalf(drivetrain.pose)
392+ // })\][
393+
394+ // ControlBoard.quasiForward.whileTrue(
395+ // drivetrain.sysIdQuasistatic(SysIdRoutine.Direction.kForward))
396+ // ControlBoard.quasiBackward.whileTrue(
397+ // drivetrain.sysIdQuasistatic(SysIdRoutine.Direction.kReverse))
398+ //
399+ // ControlBoard.dynamicForward.whileTrue(drivetrain.sysIdDynamic(SysIdRoutine.Direction.kForward))
400+ //
401+ // ControlBoard.dynamicBackward.whileTrue(drivetrain.sysIdDynamic(SysIdRoutine.Direction.kReverse))
336402
337403 ControlBoard .eject.onTrue(superstructure.requestEjectCommand())
338404 }
@@ -341,7 +407,8 @@ object RobotContainer {
341407
342408 fun mapTunableCommands () {}
343409
344- fun getAutonomousCommand () = AutonomousSelector .getCommand(drivetrain, vision, superstructure)
410+ fun getAutonomousCommand () =
411+ AutonomousSelector .getCommand(drivetrain, vision, superstructure, intake)
345412
346413 fun resetSimulationField () {
347414 if (! RobotBase .isSimulation()) return
0 commit comments