2024-01-08 11:38:08 -07:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
|
|
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
package frc4388.robot;
|
|
|
|
|
|
2024-02-19 09:41:58 -07:00
|
|
|
import edu.wpi.first.cameraserver.CameraServer;
|
2024-03-06 18:06:21 -07:00
|
|
|
import edu.wpi.first.math.geometry.Translation2d;
|
2024-02-17 11:06:50 -07:00
|
|
|
import edu.wpi.first.wpilibj.DriverStation;
|
2024-01-18 17:56:52 -07:00
|
|
|
import edu.wpi.first.wpilibj.GenericHID;
|
2024-03-12 10:37:36 -06:00
|
|
|
import edu.wpi.first.wpilibj.GenericHID.RumbleType;
|
2024-01-08 11:38:08 -07:00
|
|
|
import edu.wpi.first.wpilibj2.command.Command;
|
|
|
|
|
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
2024-02-21 20:27:48 -07:00
|
|
|
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
|
2024-01-08 11:38:08 -07:00
|
|
|
import edu.wpi.first.wpilibj2.command.RunCommand;
|
2024-02-10 15:48:00 -07:00
|
|
|
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
2024-02-19 10:55:15 -07:00
|
|
|
import edu.wpi.first.wpilibj2.command.WaitCommand;
|
2024-02-10 15:48:00 -07:00
|
|
|
import edu.wpi.first.wpilibj2.command.WaitUntilCommand;
|
2024-01-08 11:38:08 -07:00
|
|
|
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
|
2024-03-09 14:31:26 -07:00
|
|
|
import edu.wpi.first.wpilibj2.command.button.Trigger;
|
2024-03-16 16:03:41 -06:00
|
|
|
import frc4388.robot.Constants.IntakeConstants;
|
2024-01-19 18:59:38 -07:00
|
|
|
import frc4388.robot.Constants.OIConstants;
|
2024-03-16 16:03:41 -06:00
|
|
|
import frc4388.robot.Constants.ShooterConstants;
|
2024-02-15 15:38:47 -07:00
|
|
|
import frc4388.robot.commands.Autos.AutoAlign;
|
2024-01-19 18:59:38 -07:00
|
|
|
import frc4388.robot.commands.Autos.PlaybackChooser;
|
2024-01-08 11:38:08 -07:00
|
|
|
import frc4388.robot.commands.Swerve.JoystickPlayback;
|
|
|
|
|
import frc4388.robot.commands.Swerve.JoystickRecorder;
|
2024-02-18 18:55:02 -07:00
|
|
|
import frc4388.robot.commands.Swerve.neoJoystickPlayback;
|
|
|
|
|
import frc4388.robot.commands.Swerve.neoJoystickRecorder;
|
2024-02-13 20:01:12 -07:00
|
|
|
import frc4388.robot.commands.Intake.ArmIntakeIn;
|
2024-02-21 20:27:48 -07:00
|
|
|
import frc4388.robot.commands.Autos.ArmIntakeInAuto;
|
2024-01-08 11:38:08 -07:00
|
|
|
import frc4388.robot.subsystems.LED;
|
2024-02-15 15:38:47 -07:00
|
|
|
import frc4388.robot.subsystems.Limelight;
|
2024-01-08 13:47:43 -07:00
|
|
|
import frc4388.robot.subsystems.SwerveDrive;
|
2024-01-20 10:10:17 -07:00
|
|
|
import frc4388.robot.subsystems.Shooter;
|
2024-03-09 14:31:26 -07:00
|
|
|
import frc4388.robot.subsystems.Climber;
|
2024-01-20 10:10:17 -07:00
|
|
|
import frc4388.robot.subsystems.Intake;
|
2024-03-06 16:29:42 -07:00
|
|
|
import frc4388.utility.DeferredBlock;
|
2024-03-09 14:31:26 -07:00
|
|
|
import frc4388.utility.configurable.ConfigurableString;
|
2024-01-08 13:47:43 -07:00
|
|
|
import frc4388.utility.controller.DeadbandedXboxController;
|
2024-02-18 18:55:02 -07:00
|
|
|
import frc4388.utility.controller.VirtualController;
|
2024-01-08 11:38:08 -07:00
|
|
|
import frc4388.utility.controller.XboxController;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This class is where the bulk of the robot should be declared. Since
|
|
|
|
|
* Command-based is a "declarative" paradigm, very little robot logic should
|
|
|
|
|
* actually be handled in the {@link Robot} periodic methods (other than the
|
|
|
|
|
* scheduler calls). Instead, the structure of the robot (including subsystems,
|
|
|
|
|
* commands, and button mappings) should be declared here.
|
|
|
|
|
*/
|
|
|
|
|
public class RobotContainer {
|
|
|
|
|
/* RobotMap */
|
|
|
|
|
private final RobotMap m_robotMap = new RobotMap();
|
|
|
|
|
|
|
|
|
|
/* Subsystems */
|
2024-02-13 20:01:12 -07:00
|
|
|
private final LED m_robotLED = new LED();
|
2024-01-08 11:38:08 -07:00
|
|
|
|
2024-01-08 13:47:43 -07:00
|
|
|
public final SwerveDrive m_robotSwerveDrive = new SwerveDrive(m_robotMap.leftFront,
|
|
|
|
|
m_robotMap.rightFront,
|
|
|
|
|
m_robotMap.leftBack,
|
|
|
|
|
m_robotMap.rightBack,
|
2024-02-16 12:59:22 -07:00
|
|
|
|
2024-01-08 13:47:43 -07:00
|
|
|
m_robotMap.gyro);
|
2024-02-16 12:59:22 -07:00
|
|
|
/* Limelight */
|
2024-03-11 15:44:32 -06:00
|
|
|
private final Limelight limelight = new Limelight();
|
2024-02-16 12:59:22 -07:00
|
|
|
|
2024-03-09 14:31:26 -07:00
|
|
|
private final Shooter m_robotShooter = new Shooter(m_robotMap.leftShooter, m_robotMap.rightShooter, limelight);
|
2024-01-26 18:10:29 -07:00
|
|
|
|
2024-03-09 14:31:26 -07:00
|
|
|
private final Climber m_robotClimber = new Climber(m_robotMap.climbMotor);
|
|
|
|
|
|
2024-01-25 19:43:04 -07:00
|
|
|
//private final Intake m_robotIntake = new Intake(m_robotMap.intakeMotor, m_robotMap.pivotMotor);
|
2024-01-08 13:47:43 -07:00
|
|
|
|
2024-01-08 11:38:08 -07:00
|
|
|
/* Controllers */
|
2024-01-08 13:47:43 -07:00
|
|
|
private final DeadbandedXboxController m_driverXbox = new DeadbandedXboxController(OIConstants.XBOX_DRIVER_ID);
|
2024-02-19 15:04:55 -07:00
|
|
|
private final DeadbandedXboxController m_operatorXbox = new DeadbandedXboxController(OIConstants.XBOX_OPERATOR_ID);
|
2024-03-07 19:22:41 -07:00
|
|
|
private final DeadbandedXboxController m_autoRecorderXbox = new DeadbandedXboxController(2);
|
2024-03-11 15:44:32 -06:00
|
|
|
|
2024-03-11 15:59:17 -06:00
|
|
|
private final Intake m_robotIntake = new Intake(m_robotMap.intakeMotor, m_robotMap.pivotMotor);
|
2024-01-08 11:38:08 -07:00
|
|
|
|
2024-02-18 18:55:02 -07:00
|
|
|
/* Virtual Controllers */
|
2024-03-07 19:22:41 -07:00
|
|
|
private final VirtualController m_virtualDriver = new VirtualController(0);
|
|
|
|
|
private final VirtualController m_virtualOperator = new VirtualController(1);
|
2024-01-08 11:38:08 -07:00
|
|
|
|
2024-02-13 20:01:12 -07:00
|
|
|
private Command intakeToShootStuff = new ArmIntakeIn(m_robotIntake, m_robotShooter);
|
2024-03-06 16:29:42 -07:00
|
|
|
private Command interrupt = new InstantCommand(() -> {}, m_robotIntake, m_robotShooter);
|
2024-01-19 18:59:38 -07:00
|
|
|
|
2024-03-12 10:37:36 -06:00
|
|
|
private ParallelCommandGroup intakeToShoot = new ParallelCommandGroup(
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonPIDIn()),
|
2024-03-12 16:10:20 -06:00
|
|
|
new InstantCommand(() -> m_robotShooter.idle())
|
|
|
|
|
// new InstantCommand(() -> m_driverXbox.setRumble(RumbleType.kRightRumble, 1.0)).andThen(new WaitCommand(0.2)).andThen(new InstantCommand(() -> m_driverXbox.setRumble(RumbleType.kRightRumble, 0.0))),
|
|
|
|
|
// new InstantCommand(() -> m_robotShooter.spin())
|
2024-02-10 15:48:00 -07:00
|
|
|
);
|
|
|
|
|
|
2024-02-21 00:03:15 -07:00
|
|
|
// private SequentialCommandGroup outtakeToShootFull = new SequentialCommandGroup(
|
|
|
|
|
// new InstantCommand(() -> m_robotShooter.spin()),
|
|
|
|
|
// new InstantCommand(() -> m_robotIntake.handoff())
|
|
|
|
|
// );
|
2024-02-10 15:48:00 -07:00
|
|
|
|
2024-02-21 00:03:15 -07:00
|
|
|
// private SequentialCommandGroup intakeInToOut = new SequentialCommandGroup(
|
|
|
|
|
// new InstantCommand(() -> m_robotIntake.rotateArmOut2(), m_robotIntake),
|
|
|
|
|
// new RunCommand(() -> m_robotIntake.limitNote(), m_robotIntake).until(m_robotIntake.getArmFowardLimitState()),
|
|
|
|
|
// new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter)
|
|
|
|
|
// );
|
2024-02-10 15:48:00 -07:00
|
|
|
|
2024-02-16 17:04:46 -07:00
|
|
|
|
2024-03-06 16:29:42 -07:00
|
|
|
// ! Teleop Commands
|
|
|
|
|
|
2024-02-16 17:04:46 -07:00
|
|
|
private AutoAlign autoAlign = new AutoAlign(m_robotSwerveDrive, limelight);
|
|
|
|
|
|
2024-02-15 15:38:47 -07:00
|
|
|
private SequentialCommandGroup autoShoot = new SequentialCommandGroup(
|
2024-02-20 19:42:53 -07:00
|
|
|
// MoveToSpeaker,
|
2024-02-16 17:04:46 -07:00
|
|
|
autoAlign,
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.spin()),
|
2024-02-19 10:55:15 -07:00
|
|
|
new WaitCommand(3.0),
|
2024-02-21 00:03:15 -07:00
|
|
|
new InstantCommand(() -> m_robotIntake.talonHandoff(), m_robotIntake),
|
2024-02-19 10:55:15 -07:00
|
|
|
new WaitCommand(3.0),
|
2024-02-16 17:04:46 -07:00
|
|
|
new InstantCommand(() -> m_robotShooter.idle()),
|
|
|
|
|
new InstantCommand(() -> autoAlign.reverse()),
|
2024-02-19 10:55:15 -07:00
|
|
|
autoAlign.asProxy()
|
2024-02-15 15:38:47 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
2024-02-13 20:01:12 -07:00
|
|
|
private SequentialCommandGroup i = new SequentialCommandGroup(
|
2024-03-12 10:37:36 -06:00
|
|
|
intakeToShootStuff, intakeToShoot,
|
2024-03-09 14:31:26 -07:00
|
|
|
new InstantCommand(() -> m_robotShooter.idle())
|
2024-02-13 20:01:12 -07:00
|
|
|
);
|
2024-02-10 15:48:00 -07:00
|
|
|
|
2024-02-13 20:01:12 -07:00
|
|
|
private SequentialCommandGroup ejectToShoot = new SequentialCommandGroup(
|
2024-02-21 20:27:48 -07:00
|
|
|
new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
|
|
|
|
|
new WaitCommand(0.75),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonHandoff(), m_robotIntake)
|
2024-02-13 20:01:12 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
private SequentialCommandGroup turnOffShoot = new SequentialCommandGroup(
|
2024-03-15 14:39:35 -06:00
|
|
|
new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter)
|
|
|
|
|
// new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake)
|
2024-02-13 20:01:12 -07:00
|
|
|
);
|
2024-02-10 15:48:00 -07:00
|
|
|
|
2024-03-06 16:29:42 -07:00
|
|
|
private SequentialCommandGroup emergencyRetract = new SequentialCommandGroup(
|
|
|
|
|
interrupt,
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonPIDIn(), m_robotIntake),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
private SequentialCommandGroup ampShoot = new SequentialCommandGroup(
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.ampPosition()),
|
2024-03-16 16:03:41 -06:00
|
|
|
new InstantCommand(() -> m_robotIntake.ampOuttake(0.1)) //TODO: Find Actual Speed
|
2024-03-06 16:29:42 -07:00
|
|
|
);
|
|
|
|
|
|
2024-02-29 06:45:18 -07:00
|
|
|
// ! /* Autos */
|
2024-02-22 19:56:56 -07:00
|
|
|
private Command taxi = new JoystickPlayback(m_robotSwerveDrive, "Taxi.txt"); //new InstantCommand();
|
2024-02-18 18:55:02 -07:00
|
|
|
private Command startLeftMoveRight = new InstantCommand(); // new JoystickPlayback(m_robotSwerveDrive, "StartLeftMoveRight.txt");
|
|
|
|
|
private Command startRightMoveLeft = new InstantCommand(); // new JoystickPlayback(m_robotSwerveDrive, "StartRightMoveLeft.txt");
|
2024-03-06 16:29:42 -07:00
|
|
|
|
2024-03-09 14:31:26 -07:00
|
|
|
private ConfigurableString autoplaybackName = new ConfigurableString("Auto Playback Name", "defualt.auto");
|
2024-02-09 22:01:27 -07:00
|
|
|
|
2024-02-29 06:45:18 -07:00
|
|
|
//Help Simplify Shooting
|
2024-03-06 16:29:42 -07:00
|
|
|
// private SequentialCommandGroup pullInArmtoShoot = new SequentialCommandGroup(
|
|
|
|
|
// new InstantCommand(() -> m_robotIntake.talonPIDIn()),
|
|
|
|
|
// new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
|
|
|
|
|
// new WaitCommand(1.4).asProxy(),
|
|
|
|
|
// new InstantCommand(() -> m_robotIntake.talonHandoff(), m_robotIntake),
|
|
|
|
|
// new WaitCommand(0.5),
|
|
|
|
|
// new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter),
|
|
|
|
|
// new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake)
|
|
|
|
|
// );
|
2024-02-29 06:45:18 -07:00
|
|
|
|
2024-02-16 21:49:50 -07:00
|
|
|
private SequentialCommandGroup oneNoteStartingSpeaker = new SequentialCommandGroup (
|
2024-02-19 09:41:58 -07:00
|
|
|
new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
|
|
|
|
|
new WaitCommand(1).asProxy(),
|
2024-02-20 18:56:57 -07:00
|
|
|
new InstantCommand(() -> m_robotIntake.talonHandoff(), m_robotIntake),
|
2024-02-19 09:41:58 -07:00
|
|
|
new WaitCommand(1).asProxy(),
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter),
|
2024-02-20 18:56:57 -07:00
|
|
|
new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake),
|
2024-02-19 09:41:58 -07:00
|
|
|
new WaitCommand(1).asProxy(),
|
|
|
|
|
new JoystickPlayback(m_robotSwerveDrive, "Taxi.txt")
|
|
|
|
|
);
|
|
|
|
|
private SequentialCommandGroup oneNoteStartingSpeakerStationary = new SequentialCommandGroup (
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
|
|
|
|
|
new WaitCommand(1).asProxy(),
|
2024-02-20 18:56:57 -07:00
|
|
|
new InstantCommand(() -> m_robotIntake.talonHandoff(), m_robotIntake),
|
2024-02-19 09:41:58 -07:00
|
|
|
new WaitCommand(1).asProxy(),
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter),
|
2024-02-20 18:56:57 -07:00
|
|
|
new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake)
|
2024-02-16 21:49:50 -07:00
|
|
|
);
|
|
|
|
|
private SequentialCommandGroup oneNoteStartingFromLeft = new SequentialCommandGroup(
|
2024-02-17 10:16:20 -07:00
|
|
|
startLeftMoveRight.asProxy(),
|
|
|
|
|
ejectToShoot.asProxy(),
|
|
|
|
|
taxi.asProxy()
|
2024-02-16 21:49:50 -07:00
|
|
|
);
|
|
|
|
|
private SequentialCommandGroup oneNoteStartingFromRight = new SequentialCommandGroup(
|
2024-02-17 10:16:20 -07:00
|
|
|
startRightMoveLeft.asProxy(),
|
|
|
|
|
ejectToShoot.asProxy(),
|
|
|
|
|
taxi.asProxy()
|
2024-02-16 21:49:50 -07:00
|
|
|
);
|
2024-02-21 20:27:48 -07:00
|
|
|
|
2024-02-22 19:56:56 -07:00
|
|
|
|
2024-02-19 09:41:58 -07:00
|
|
|
private SequentialCommandGroup twoNoteStartingFromSpeaker = new SequentialCommandGroup(
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
|
|
|
|
|
new WaitCommand(1).asProxy(),
|
2024-02-20 18:56:57 -07:00
|
|
|
new InstantCommand(() -> m_robotIntake.talonHandoff(), m_robotIntake),
|
2024-02-19 09:41:58 -07:00
|
|
|
new WaitCommand(1).asProxy(),
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter),
|
2024-02-20 18:56:57 -07:00
|
|
|
new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake),
|
2024-02-21 20:27:48 -07:00
|
|
|
new ArmIntakeInAuto(m_robotIntake, m_robotShooter, m_robotSwerveDrive),
|
2024-03-06 16:29:42 -07:00
|
|
|
new InstantCommand(() -> m_robotIntake.talonPIDIn()),
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
|
|
|
|
|
new WaitCommand(1.4).asProxy(),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonHandoff(), m_robotIntake),
|
|
|
|
|
new WaitCommand(0.5),
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake),
|
2024-02-21 20:27:48 -07:00
|
|
|
new JoystickPlayback(m_robotSwerveDrive, "Taxi.txt")
|
|
|
|
|
// new WaitCommand(1).asProxy(),
|
|
|
|
|
// new JoystickPlayback(m_robotSwerveDrive, "TwoNotePrt2.txt"),
|
|
|
|
|
// new WaitCommand(0.5).asProxy(),
|
|
|
|
|
// new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
|
|
|
|
|
// new WaitCommand(1).asProxy(),
|
|
|
|
|
// new InstantCommand(() -> m_robotIntake.talonHandoff(), m_robotIntake),
|
|
|
|
|
// new WaitCommand(1).asProxy(),
|
|
|
|
|
// new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter),
|
|
|
|
|
// new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake)
|
2024-02-19 09:41:58 -07:00
|
|
|
);
|
2024-02-29 06:45:18 -07:00
|
|
|
|
2024-03-06 16:29:42 -07:00
|
|
|
private SequentialCommandGroup stayTwoNoteStartingFromSpeaker = new SequentialCommandGroup(
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
|
|
|
|
|
new WaitCommand(1).asProxy(),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonHandoff(), m_robotIntake),
|
|
|
|
|
new WaitCommand(1).asProxy(),
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake),
|
|
|
|
|
new ArmIntakeInAuto(m_robotIntake, m_robotShooter, m_robotSwerveDrive),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonPIDIn()),
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
|
|
|
|
|
new WaitCommand(1.4).asProxy(),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonHandoff(), m_robotIntake),
|
|
|
|
|
new WaitCommand(0.5),
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake)
|
|
|
|
|
);
|
|
|
|
|
|
2024-02-29 06:45:18 -07:00
|
|
|
private SequentialCommandGroup threeNoteStartingFromSpeaker = new SequentialCommandGroup(
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
|
|
|
|
|
new WaitCommand(1).asProxy(),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonHandoff(), m_robotIntake),
|
|
|
|
|
new WaitCommand(1).asProxy(),
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake),
|
|
|
|
|
new ArmIntakeInAuto(m_robotIntake, m_robotShooter, m_robotSwerveDrive),
|
2024-03-06 16:29:42 -07:00
|
|
|
new InstantCommand(() -> m_robotIntake.talonPIDIn()),
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
|
|
|
|
|
new WaitCommand(1.4).asProxy(),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonHandoff(), m_robotIntake),
|
|
|
|
|
new WaitCommand(0.5),
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake),
|
2024-02-29 06:45:18 -07:00
|
|
|
//? Create Another Parallel Command Group :(
|
2024-03-06 16:29:42 -07:00
|
|
|
new InstantCommand(() -> m_robotIntake.talonPIDIn()),
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter),
|
|
|
|
|
new WaitCommand(1.4).asProxy(),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonHandoff(), m_robotIntake),
|
|
|
|
|
new WaitCommand(0.5),
|
|
|
|
|
new InstantCommand(() -> m_robotShooter.stop(), m_robotShooter),
|
|
|
|
|
new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake),
|
2024-02-29 06:45:18 -07:00
|
|
|
new JoystickPlayback(m_robotSwerveDrive, "Taxi.txt")
|
|
|
|
|
);
|
|
|
|
|
|
2024-02-10 13:11:30 -07:00
|
|
|
private PlaybackChooser playbackChooser = new PlaybackChooser(m_robotSwerveDrive)
|
2024-02-17 10:16:20 -07:00
|
|
|
.addOption("Taxi Auto", taxi.asProxy())
|
2024-03-06 16:29:42 -07:00
|
|
|
.addOption("One Note Auto Starting in Front of Speaker", oneNoteStartingSpeaker.asProxy())
|
|
|
|
|
.addOption("Stay One Note Auto Starting in Front of Speaker", oneNoteStartingSpeakerStationary.asProxy())
|
|
|
|
|
// .addOption("One Note Auto Starting from Left Position", oneNoteStartingFromLeft.asProxy())
|
|
|
|
|
// .addOption("One Note Auto Starting from Right Position", oneNoteStartingFromRight.asProxy())
|
|
|
|
|
.addOption("Two Note Starting in Front of Speaker", twoNoteStartingFromSpeaker.asProxy())
|
|
|
|
|
.addOption("Stay Two Note Starting in Front of Speaker", stayTwoNoteStartingFromSpeaker.asProxy())
|
2024-02-10 13:11:30 -07:00
|
|
|
.buildDisplay();
|
2024-02-16 21:49:50 -07:00
|
|
|
|
|
|
|
|
|
2024-01-19 18:59:38 -07:00
|
|
|
|
2024-01-08 11:38:08 -07:00
|
|
|
/**
|
|
|
|
|
* The container for the robot. Contains subsystems, OI devices, and commands.
|
|
|
|
|
*/
|
|
|
|
|
public RobotContainer() {
|
2024-02-19 15:04:55 -07:00
|
|
|
configureButtonBindings();
|
2024-03-07 19:22:41 -07:00
|
|
|
configureVirtualButtonBindings();
|
2024-03-08 18:01:58 -07:00
|
|
|
new DeferredBlock(() -> m_robotSwerveDrive.resetGyro());
|
2024-02-19 15:04:55 -07:00
|
|
|
|
2024-01-08 11:38:08 -07:00
|
|
|
|
2024-03-07 19:22:41 -07:00
|
|
|
DriverStation.silenceJoystickConnectionWarning(true);
|
|
|
|
|
CameraServer.startAutomaticCapture();
|
2024-01-08 11:38:08 -07:00
|
|
|
|
2024-03-07 19:22:41 -07:00
|
|
|
/* Default Commands */
|
|
|
|
|
// drives the robot with a two-axis input from the driver controller
|
|
|
|
|
// ! Swerve Drive Default Command (Regular Rotation)
|
|
|
|
|
m_robotSwerveDrive.setDefaultCommand(new RunCommand(() -> {
|
|
|
|
|
m_robotSwerveDrive.driveWithInput(getDeadbandedDriverController().getLeft(),
|
|
|
|
|
getDeadbandedDriverController().getRight(),
|
|
|
|
|
true);
|
|
|
|
|
}, m_robotSwerveDrive)
|
|
|
|
|
.withName("SwerveDrive DefaultCommand"));
|
2024-03-11 15:44:32 -06:00
|
|
|
m_robotSwerveDrive.setToSlow();
|
2024-02-29 06:45:18 -07:00
|
|
|
|
|
|
|
|
// ! Swerve Drive Default Command (Orientation Rotation)
|
|
|
|
|
// m_robotSwerveDrive.setDefaultCommand(new RunCommand(() -> {
|
|
|
|
|
// m_robotSwerveDrive.driveWithInputOrientation(getDeadbandedDriverController().getLeft(),
|
|
|
|
|
// getDeadbandedDriverController().getRightX(),
|
|
|
|
|
// getDeadbandedDriverController().getRightY(),
|
|
|
|
|
// true);
|
|
|
|
|
// }, m_robotSwerveDrive)
|
|
|
|
|
// .withName("SwerveDrive OrientationCommand"));
|
2024-01-08 11:38:08 -07:00
|
|
|
// continually sends updates to the Blinkin LED controller to keep the lights on
|
|
|
|
|
m_robotLED.setDefaultCommand(new RunCommand(() -> m_robotLED.updateLED(), m_robotLED));
|
2024-01-19 18:59:38 -07:00
|
|
|
|
2024-01-08 11:38:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Use this method to define your button->command mappings. Buttons can be
|
|
|
|
|
* created by instantiating a {@link GenericHID} or one of its subclasses
|
|
|
|
|
* ({@link edu.wpi.first.wpilibj.Joystick} or {@link XboxController}), and then
|
|
|
|
|
* passing it to a {@link edu.wpi.first.wpilibj2.command.button.JoystickButton}.
|
|
|
|
|
*/
|
|
|
|
|
private void configureButtonBindings() {
|
2024-02-22 17:59:22 -07:00
|
|
|
|
|
|
|
|
// ? /* Driver Buttons */
|
|
|
|
|
|
2024-01-13 15:39:56 -07:00
|
|
|
new JoystickButton(getDeadbandedDriverController(), XboxController.A_BUTTON)
|
2024-02-21 00:03:15 -07:00
|
|
|
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.resetGyroFlip(), m_robotSwerveDrive));
|
2024-03-09 14:31:26 -07:00
|
|
|
|
2024-03-11 15:44:32 -06:00
|
|
|
new Trigger(() -> getDeadbandedDriverController().getPOV() == 0)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.resetGyroRightBlue()));
|
|
|
|
|
|
|
|
|
|
new Trigger(() -> getDeadbandedDriverController().getPOV() == 180)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.resetGyroRightAmp()));
|
2024-03-15 14:51:56 -06:00
|
|
|
|
|
|
|
|
// * /* D-Pad Stuff */
|
|
|
|
|
new Trigger(() -> getDeadbandedDriverController().getRawAxis(XboxController.TOP_BOTTOM_DPAD_AXIS) > 0.9)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 1),
|
|
|
|
|
new Translation2d(0, 0),
|
|
|
|
|
true)))
|
|
|
|
|
.onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0),
|
|
|
|
|
new Translation2d(0, 0),
|
|
|
|
|
true)));
|
|
|
|
|
|
|
|
|
|
new Trigger(() -> getDeadbandedDriverController().getRawAxis(XboxController.TOP_BOTTOM_DPAD_AXIS) > -0.9)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, -1),
|
|
|
|
|
new Translation2d(0, 0),
|
|
|
|
|
true)))
|
|
|
|
|
.onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0),
|
|
|
|
|
new Translation2d(0, 0),
|
|
|
|
|
true)));
|
|
|
|
|
|
|
|
|
|
new Trigger(() -> getDeadbandedDriverController().getRawAxis(XboxController.LEFT_RIGHT_DPAD_AXIS) > 0.9)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(1, 0),
|
|
|
|
|
new Translation2d(0, 0),
|
|
|
|
|
true)))
|
|
|
|
|
.onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0),
|
|
|
|
|
new Translation2d(0, 0),
|
|
|
|
|
true)));
|
|
|
|
|
|
|
|
|
|
new Trigger(() -> getDeadbandedDriverController().getRawAxis(XboxController.LEFT_RIGHT_DPAD_AXIS) > -0.9)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(-1, 0),
|
|
|
|
|
new Translation2d(0, 0),
|
|
|
|
|
true)))
|
|
|
|
|
.onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0),
|
|
|
|
|
new Translation2d(0, 0),
|
|
|
|
|
true)));
|
2024-01-19 18:59:38 -07:00
|
|
|
|
2024-02-22 17:59:22 -07:00
|
|
|
// ! /* Auto Recording */
|
2024-03-16 16:03:41 -06:00
|
|
|
// new JoystickButton(m_autoRecorderXbox, XboxController.LEFT_BUMPER_BUTTON)
|
|
|
|
|
// .whileTrue(new neoJoystickRecorder(m_robotSwerveDrive,
|
|
|
|
|
// new DeadbandedXboxController[]{getDeadbandedDriverController(), getDeadbandedOperatorController()},
|
|
|
|
|
// () -> autoplaybackName.get()))
|
|
|
|
|
// .onFalse(new InstantCommand());
|
2024-01-19 18:59:38 -07:00
|
|
|
|
2024-03-16 16:03:41 -06:00
|
|
|
// new JoystickButton(m_autoRecorderXbox, XboxController.RIGHT_BUMPER_BUTTON)
|
|
|
|
|
// .onTrue(new neoJoystickPlayback(m_robotSwerveDrive,
|
|
|
|
|
// () -> autoplaybackName.get(),
|
|
|
|
|
// new VirtualController[]{getVirtualDriverController(), getVirtualOperatorController()},
|
|
|
|
|
// true, false))
|
|
|
|
|
// .onFalse(new InstantCommand());
|
2024-02-18 18:55:02 -07:00
|
|
|
|
2024-03-15 14:51:56 -06:00
|
|
|
// new JoystickButton(getDeadbandedDriverController(), XboxController.RIGHT_BUMPER_BUTTON)
|
|
|
|
|
// .whileTrue(new JoystickRecorder(m_robotSwerveDrive,
|
|
|
|
|
// () -> getDeadbandedDriverController().getLeftX(),
|
|
|
|
|
// () -> getDeadbandedDriverController().getLeftY(),
|
|
|
|
|
// () -> getDeadbandedDriverController().getRightX(),
|
|
|
|
|
// () -> getDeadbandedDriverController().getRightY(),
|
|
|
|
|
// "Taxi.txt"))
|
|
|
|
|
// .onFalse(new InstantCommand());
|
|
|
|
|
|
|
|
|
|
// new JoystickButton(getDeadbandedDriverController(), XboxController.LEFT_BUMPER_BUTTON)
|
|
|
|
|
// .onTrue(new JoystickPlayback(m_robotSwerveDrive, "Taxi.txt"))
|
|
|
|
|
// .onFalse(new InstantCommand());
|
2024-02-22 17:59:22 -07:00
|
|
|
// ! /* Speed */
|
2024-03-16 16:03:41 -06:00
|
|
|
new JoystickButton(getDeadbandedDriverController(), XboxController.RIGHT_BUMPER_BUTTON) // final
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftUp()));
|
|
|
|
|
// .onFalse(new InstantCommand(() -> m_robotSwerveDrive.setToFast()));
|
2024-01-19 18:59:38 -07:00
|
|
|
|
2024-03-16 16:03:41 -06:00
|
|
|
new JoystickButton(getDeadbandedDriverController(), XboxController.LEFT_BUMPER_BUTTON) // final
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftDown()));
|
|
|
|
|
|
|
|
|
|
new Trigger(() -> getDeadbandedDriverController().getPOV() == 270)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftDownRot()));
|
|
|
|
|
|
|
|
|
|
new Trigger(() -> getDeadbandedDriverController().getPOV() == 90)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftUpRot()));
|
2024-01-19 18:59:38 -07:00
|
|
|
|
2024-03-16 16:03:41 -06:00
|
|
|
// new JoystickButton(getDeadbandedDriverController(), XboxController.Y_BUTTON)
|
|
|
|
|
// .whileTrue(new InstantCommand(() ->
|
|
|
|
|
// m_robotSwerveDrive.driveWithInput(new Translation2d(0, 1),
|
|
|
|
|
// new Translation2d(0, 0),
|
|
|
|
|
// true), m_robotSwerveDrive));
|
2024-03-06 18:06:21 -07:00
|
|
|
|
2024-01-26 18:10:29 -07:00
|
|
|
|
2024-02-22 17:59:22 -07:00
|
|
|
//? /* Operator Buttons */
|
2024-02-09 22:01:27 -07:00
|
|
|
|
2024-02-22 20:01:13 -07:00
|
|
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.Y_BUTTON)
|
2024-02-20 18:56:57 -07:00
|
|
|
.onTrue(new InstantCommand(() -> m_robotIntake.talonPIDIn()))
|
|
|
|
|
.onFalse(new InstantCommand(() -> m_robotIntake.talonStopArmMotor()));
|
2024-02-09 22:01:27 -07:00
|
|
|
|
2024-02-29 06:45:18 -07:00
|
|
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.X_BUTTON)
|
2024-02-20 18:56:57 -07:00
|
|
|
.onTrue(new InstantCommand(() -> m_robotIntake.talonPIDOut()))
|
|
|
|
|
.onFalse(new InstantCommand(() -> m_robotIntake.talonStopArmMotor()));
|
2024-02-09 22:01:27 -07:00
|
|
|
|
2024-02-21 00:03:15 -07:00
|
|
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.A_BUTTON)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotIntake.talonHandoff()))
|
2024-02-20 18:56:57 -07:00
|
|
|
.onFalse(new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors()));
|
2024-02-29 06:45:18 -07:00
|
|
|
|
|
|
|
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.B_BUTTON)
|
|
|
|
|
.onTrue(emergencyRetract);
|
2024-02-19 09:41:58 -07:00
|
|
|
|
2024-02-16 21:49:50 -07:00
|
|
|
|
|
|
|
|
// Override Intake Position encoder: out
|
|
|
|
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.BACK_BUTTON)
|
2024-03-16 16:03:41 -06:00
|
|
|
.onTrue(new InstantCommand(() -> m_robotIntake.talonSetPivotEncoderPosition(-55), m_robotIntake));
|
2024-02-16 21:49:50 -07:00
|
|
|
|
2024-02-17 10:16:20 -07:00
|
|
|
// Override Intake Position encoder: in
|
2024-02-16 21:49:50 -07:00
|
|
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.START_BUTTON)
|
2024-03-16 16:03:41 -06:00
|
|
|
.onTrue(new InstantCommand(() -> m_robotIntake.talonSetPivotEncoderPosition(-6.2), m_robotIntake));
|
2024-02-16 21:49:50 -07:00
|
|
|
|
2024-02-10 15:48:00 -07:00
|
|
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.LEFT_BUMPER_BUTTON)
|
2024-03-16 16:03:41 -06:00
|
|
|
.onTrue(new InstantCommand(() -> m_robotShooter.spin(0.5), m_robotShooter))
|
2024-02-13 20:01:12 -07:00
|
|
|
.onFalse(turnOffShoot);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.RIGHT_BUMPER_BUTTON)
|
|
|
|
|
.onTrue(i)
|
2024-02-20 18:56:57 -07:00
|
|
|
.onFalse(new InstantCommand(() -> m_robotIntake.talonPIDIn()));
|
2024-02-10 13:11:30 -07:00
|
|
|
|
2024-02-19 15:04:55 -07:00
|
|
|
//spins up shooter, no wind down
|
|
|
|
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.LEFT_JOYSTICK_BUTTON)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter));
|
2024-01-12 20:29:50 -07:00
|
|
|
|
2024-02-22 19:56:56 -07:00
|
|
|
// new JoystickButton(getDeadbandedOperatorController(), XboxController.RIGHT_JOYSTICK_BUTTON)
|
|
|
|
|
// .onTrue(new InstantCommand(() -> m_robotIntake.talonSpinIntakeMotor(), m_robotIntake))
|
|
|
|
|
// .onFalse(new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake));
|
|
|
|
|
|
2024-02-21 20:27:48 -07:00
|
|
|
new JoystickButton(getDeadbandedOperatorController(), XboxController.RIGHT_JOYSTICK_BUTTON)
|
2024-02-22 19:56:56 -07:00
|
|
|
.onTrue(emergencyRetract);
|
2024-02-21 20:27:48 -07:00
|
|
|
|
2024-03-09 14:31:26 -07:00
|
|
|
new Trigger(() -> getDeadbandedOperatorController().getRawAxis(XboxController.RIGHT_TRIGGER_AXIS) > 0.5)
|
2024-03-13 14:15:53 -06:00
|
|
|
.onTrue(new InstantCommand(() -> m_robotClimber.climbOut()))
|
|
|
|
|
.onFalse(new InstantCommand(() -> m_robotClimber.stopClimb()));
|
|
|
|
|
|
|
|
|
|
new Trigger(() -> getDeadbandedOperatorController().getRawAxis(XboxController.LEFT_TRIGGER_AXIS) > 0.5)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotClimber.climbIn()))
|
|
|
|
|
.onFalse(new InstantCommand(() -> m_robotClimber.stopClimb()));
|
2024-03-09 14:31:26 -07:00
|
|
|
|
2024-03-11 15:44:32 -06:00
|
|
|
new Trigger(() -> getDeadbandedOperatorController().getPOV() == 0)
|
2024-03-16 16:03:41 -06:00
|
|
|
.onTrue(new InstantCommand(() -> m_robotIntake.ampOuttake(0.5)));
|
2024-02-21 20:27:48 -07:00
|
|
|
|
2024-01-08 11:38:08 -07:00
|
|
|
}
|
|
|
|
|
|
2024-02-21 00:03:15 -07:00
|
|
|
private void configureVirtualButtonBindings() {
|
2024-02-19 15:04:55 -07:00
|
|
|
/* Driver Buttons */
|
2024-02-29 06:45:18 -07:00
|
|
|
// new JoystickButton(getVirtualDriverController(), XboxController.A_BUTTON)
|
|
|
|
|
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.resetGyro(), m_robotSwerveDrive));
|
2024-01-19 18:59:38 -07:00
|
|
|
|
2024-02-29 06:45:18 -07:00
|
|
|
// /* Speed */
|
|
|
|
|
// new JoystickButton(getVirtualDriverController(), XboxController.RIGHT_BUMPER_BUTTON) // final
|
|
|
|
|
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftUp()));
|
|
|
|
|
// // .onFalse(new InstantCommand(() -> m_robotSwerveDrive.setToFast()));
|
2024-01-19 18:59:38 -07:00
|
|
|
|
2024-02-29 06:45:18 -07:00
|
|
|
// new JoystickButton(getVirtualDriverController(), XboxController.LEFT_BUMPER_BUTTON) // final
|
|
|
|
|
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.shiftDown()));
|
2024-01-19 18:59:38 -07:00
|
|
|
|
2024-03-11 15:44:32 -06:00
|
|
|
new Trigger(() -> getDeadbandedDriverController().getPOV() == 0)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotSwerveDrive.resetGyroRightBlue()));
|
2024-01-26 18:10:29 -07:00
|
|
|
|
|
|
|
|
|
2024-02-29 06:45:18 -07:00
|
|
|
// /* Operator Buttons */
|
2024-02-09 22:01:27 -07:00
|
|
|
|
2024-03-07 19:22:41 -07:00
|
|
|
new JoystickButton(getVirtualOperatorController(), XboxController.Y_BUTTON)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotIntake.talonPIDIn()))
|
|
|
|
|
.onFalse(new InstantCommand(() -> m_robotIntake.talonStopArmMotor()));
|
2024-02-09 22:01:27 -07:00
|
|
|
|
2024-03-07 19:22:41 -07:00
|
|
|
new JoystickButton(getVirtualOperatorController(), XboxController.X_BUTTON)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotIntake.talonPIDOut()))
|
|
|
|
|
.onFalse(new InstantCommand(() -> m_robotIntake.talonStopArmMotor()));
|
2024-02-09 22:01:27 -07:00
|
|
|
|
2024-03-07 19:22:41 -07:00
|
|
|
new JoystickButton(getVirtualOperatorController(), XboxController.A_BUTTON)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotIntake.talonHandoff()))
|
|
|
|
|
.onFalse(new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors()));
|
|
|
|
|
|
|
|
|
|
new JoystickButton(getVirtualOperatorController(), XboxController.B_BUTTON)
|
|
|
|
|
.onTrue(emergencyRetract.asProxy());
|
2024-02-10 13:11:30 -07:00
|
|
|
|
2024-02-16 21:49:50 -07:00
|
|
|
|
2024-03-07 19:22:41 -07:00
|
|
|
// Override Intake Position encoder: out
|
|
|
|
|
new JoystickButton(getVirtualOperatorController(), XboxController.BACK_BUTTON)
|
2024-03-16 16:03:41 -06:00
|
|
|
.onTrue(new InstantCommand(() -> m_robotIntake.talonSetPivotEncoderPosition(-53), m_robotIntake));
|
2024-03-07 19:22:41 -07:00
|
|
|
|
|
|
|
|
// Override Intake Position encoder: in
|
|
|
|
|
new JoystickButton(getVirtualOperatorController(), XboxController.START_BUTTON)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotIntake.talonSetPivotEncoderPosition(0), m_robotIntake));
|
2024-02-16 21:49:50 -07:00
|
|
|
|
2024-02-10 15:48:00 -07:00
|
|
|
|
2024-03-07 19:22:41 -07:00
|
|
|
new JoystickButton(getVirtualOperatorController(), XboxController.LEFT_BUMPER_BUTTON)
|
2024-03-16 16:03:41 -06:00
|
|
|
.onTrue(new InstantCommand(() -> m_robotShooter.spin(0.5), m_robotShooter))
|
2024-03-07 19:22:41 -07:00
|
|
|
.onFalse(turnOffShoot.asProxy());
|
2024-02-13 20:01:12 -07:00
|
|
|
|
|
|
|
|
|
2024-03-07 19:22:41 -07:00
|
|
|
new JoystickButton(getVirtualOperatorController(), XboxController.RIGHT_BUMPER_BUTTON)
|
|
|
|
|
.onTrue(i.asProxy())
|
|
|
|
|
.onFalse(new InstantCommand(() -> m_robotIntake.talonPIDIn()));
|
2024-02-10 13:11:30 -07:00
|
|
|
|
2024-03-07 19:22:41 -07:00
|
|
|
//spins up shooter, no wind down
|
|
|
|
|
new JoystickButton(getVirtualOperatorController(), XboxController.LEFT_JOYSTICK_BUTTON)
|
|
|
|
|
.onTrue(new InstantCommand(() -> m_robotShooter.spin(), m_robotShooter));
|
2024-01-12 20:29:50 -07:00
|
|
|
|
2024-03-07 19:22:41 -07:00
|
|
|
// new JoystickButton(getVirtualOperatorController(), XboxController.RIGHT_JOYSTICK_BUTTON)
|
|
|
|
|
// .onTrue(new InstantCommand(() -> m_robotIntake.talonSpinIntakeMotor(), m_robotIntake))
|
|
|
|
|
// .onFalse(new InstantCommand(() -> m_robotIntake.talonStopIntakeMotors(), m_robotIntake));
|
|
|
|
|
|
|
|
|
|
new JoystickButton(getVirtualOperatorController(), XboxController.RIGHT_JOYSTICK_BUTTON)
|
|
|
|
|
.onTrue(emergencyRetract.asProxy());
|
2024-01-08 11:38:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Use this to pass the autonomous command to the main {@link Robot} class.
|
|
|
|
|
*
|
|
|
|
|
* @return the command to run in autonomous
|
|
|
|
|
*/
|
2024-02-13 20:01:12 -07:00
|
|
|
public Command getAutonomousCommand() {
|
2024-02-18 18:55:02 -07:00
|
|
|
//no auto
|
2024-03-16 16:03:41 -06:00
|
|
|
return new neoJoystickPlayback(m_robotSwerveDrive,
|
|
|
|
|
() -> autoplaybackName.get(),
|
|
|
|
|
new VirtualController[]{getVirtualDriverController(), getVirtualOperatorController()},
|
|
|
|
|
true, false);
|
|
|
|
|
//return playbackChooser.getCommand();
|
2024-02-13 20:01:12 -07:00
|
|
|
}
|
2024-01-08 11:38:08 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Add your docs here.
|
|
|
|
|
*/
|
2024-01-08 13:47:43 -07:00
|
|
|
public DeadbandedXboxController getDeadbandedDriverController() {
|
|
|
|
|
return this.m_driverXbox;
|
2024-01-08 11:38:08 -07:00
|
|
|
}
|
|
|
|
|
|
2024-01-08 13:47:43 -07:00
|
|
|
public DeadbandedXboxController getDeadbandedOperatorController() {
|
|
|
|
|
return this.m_operatorXbox;
|
2024-01-08 11:38:08 -07:00
|
|
|
}
|
2024-02-18 18:55:02 -07:00
|
|
|
|
2024-03-07 19:22:41 -07:00
|
|
|
public VirtualController getVirtualDriverController() {
|
|
|
|
|
return m_virtualDriver;
|
|
|
|
|
}
|
2024-02-18 18:55:02 -07:00
|
|
|
|
2024-03-07 19:22:41 -07:00
|
|
|
public VirtualController getVirtualOperatorController() {
|
|
|
|
|
return m_virtualOperator;
|
|
|
|
|
}
|
2024-01-08 11:38:08 -07:00
|
|
|
}
|