Deleted ManualHopperCommand because it was never called and never meant to be permanent
This commit is contained in:
parent
57fa16b4b3
commit
eb16cf40fe
|
|
@ -1 +1 @@
|
|||
Subproject commit 840c851253187081a50ca9492c032cec8d376e7b
|
||||
Subproject commit cd9dee709893a27de40fb86e441223dd4c068b12
|
||||
|
|
@ -1,12 +1,10 @@
|
|||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package frc.robot;
|
||||
|
||||
import com.pathplanner.lib.auto.NamedCommands;
|
||||
|
||||
import edu.wpi.first.wpilibj.XboxController;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import edu.wpi.first.wpilibj2.command.Commands;
|
||||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
||||
|
|
@ -14,10 +12,6 @@ import edu.wpi.first.wpilibj2.command.button.Trigger;
|
|||
import frc.robot.Constants.OperatorConstants;
|
||||
import frc.robot.commands.AutoShootCommandChassisTurret;
|
||||
import frc.robot.commands.AutoShootCommandChassisTurretPathPlanner;
|
||||
import frc.robot.commands.AutoTurretCommand;
|
||||
import frc.robot.commands.ManualHopperCommand;
|
||||
import frc.robot.commands.ManualIntake;
|
||||
import frc.robot.commands.ManualShootCommand;
|
||||
import frc.robot.commands.RelayCommand;
|
||||
import frc.robot.commands.SetDeflectorCommand;
|
||||
import frc.robot.subsystems.DriveSubsystem;
|
||||
|
|
@ -26,73 +20,80 @@ import frc.robot.subsystems.IntakeSubsystem;
|
|||
import frc.robot.subsystems.TurretSubsystem;
|
||||
|
||||
/**
|
||||
* 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 trigger mappings) should be declared here.
|
||||
* 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 trigger mappings) should be declared here.
|
||||
*/
|
||||
public class RobotContainer {
|
||||
// The robot's subsystems and commands are defined here...
|
||||
// Replace with CommandPS4Controller or CommandJoystick if needed
|
||||
private final CommandXboxController m_driverController =
|
||||
new CommandXboxController(OperatorConstants.kDriverControllerPort);
|
||||
// The robot's subsystems and commands are defined here...
|
||||
// Replace with CommandPS4Controller or CommandJoystick if needed
|
||||
|
||||
// private final CommandPS4Controller m_driverController = new CommandPS4Controller(OperatorConstants.kDriverControllerPort);
|
||||
public final DriveSubsystem driveSubsystem = new DriveSubsystem(m_driverController);
|
||||
private final CommandXboxController m_driverController
|
||||
= new CommandXboxController(OperatorConstants.kDriverControllerPort);
|
||||
|
||||
public final IntakeSubsystem intakeSubsystem = new IntakeSubsystem();
|
||||
// private final CommandPS4Controller m_driverController = new CommandPS4Controller(OperatorConstants.kDriverControllerPort);
|
||||
public final DriveSubsystem driveSubsystem = new DriveSubsystem(m_driverController);
|
||||
|
||||
public final TurretSubsystem turretSubsystem = new TurretSubsystem();
|
||||
public final IntakeSubsystem intakeSubsystem = new IntakeSubsystem();
|
||||
|
||||
public final HopperSubsystem hopperSubsystem = new HopperSubsystem();
|
||||
|
||||
/** The container for the robot. Contains subsystems, OI devices, and commands. */
|
||||
public RobotContainer() {
|
||||
public final TurretSubsystem turretSubsystem = new TurretSubsystem();
|
||||
|
||||
// turretSubsystem.setDefaultCommand(new AutoTurretCommand(turretSubsystem, driveSubsystem));
|
||||
// turretSubsystem.homeTurret();
|
||||
public final HopperSubsystem hopperSubsystem = new HopperSubsystem();
|
||||
|
||||
// Configure the trigger bindings
|
||||
configureBindings();
|
||||
/**
|
||||
* The container for the robot. Contains subsystems, OI devices, and
|
||||
* commands.
|
||||
*/
|
||||
public RobotContainer() {
|
||||
|
||||
NamedCommands.registerCommand("ChassisAlignShoot", new AutoShootCommandChassisTurret(driveSubsystem, hopperSubsystem, turretSubsystem));
|
||||
// turretSubsystem.setDefaultCommand(new AutoTurretCommand(turretSubsystem, driveSubsystem));
|
||||
// turretSubsystem.homeTurret();
|
||||
// Configure the trigger bindings
|
||||
configureBindings();
|
||||
|
||||
}
|
||||
NamedCommands.registerCommand("ChassisAlignShoot", new AutoShootCommandChassisTurret(driveSubsystem, hopperSubsystem, turretSubsystem));
|
||||
|
||||
/**
|
||||
* Use this method to define your trigger->command mappings. Triggers can be created via the
|
||||
* {@link Trigger#Trigger(java.util.function.BooleanSupplier)} constructor with an arbitrary
|
||||
* predicate, or via the named factories in {@link
|
||||
* edu.wpi.first.wpilibj2.command.button.CommandGenericHID}'s subclasses for {@link
|
||||
* CommandXboxController Xbox}/{@link edu.wpi.first.wpilibj2.command.button.CommandPS4Controller
|
||||
* PS4} controllers or {@link edu.wpi.first.wpilibj2.command.button.CommandJoystick Flight
|
||||
* joysticks}.
|
||||
* */
|
||||
}
|
||||
|
||||
private void configureBindings() {
|
||||
m_driverController.povDown().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_STORED_ANGLE));
|
||||
m_driverController.povLeft().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE1));
|
||||
m_driverController.povRight().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE3));
|
||||
m_driverController.povUp().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE2));
|
||||
|
||||
m_driverController.back().whileTrue(new AutoShootCommandChassisTurretPathPlanner(driveSubsystem, hopperSubsystem, turretSubsystem));
|
||||
//m_driverController.a().whileTrue(new AutoShootCommandChassisTurretPathPlanner(driveSubsystem, hopperSubsystem, turretSubsystem));
|
||||
// m_driverController:wa.a().whileTrue(new AutoShootCommandChassisTurret(driveSubsystem, hopperSubsystem, turretSubsystem));
|
||||
|
||||
m_driverController.leftBumper().onTrue(Commands.runOnce(() -> turretSubsystem.homeTurret(), turretSubsystem));
|
||||
m_driverController.rightBumper().onTrue(intakeSubsystem.intake());
|
||||
m_driverController.y().whileTrue(new RelayCommand(hopperSubsystem, turretSubsystem, intakeSubsystem));
|
||||
m_driverController.start().whileTrue(intakeSubsystem.resetDeploy());
|
||||
m_driverController.x().whileTrue(new AutoShootCommandChassisTurret(driveSubsystem, hopperSubsystem, turretSubsystem));
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to pass the autonomous command to the main {@link Robot} class.
|
||||
/**
|
||||
* Use this method to define your trigger->command mappings. Triggers can be
|
||||
* created via the
|
||||
* {@link Trigger#Trigger(java.util.function.BooleanSupplier)} constructor
|
||||
* with an arbitrary predicate, or via the named factories in {@link
|
||||
* edu.wpi.first.wpilibj2.command.button.CommandGenericHID}'s subclasses for {@link
|
||||
* CommandXboxController Xbox}/{@link edu.wpi.first.wpilibj2.command.button.CommandPS4Controller
|
||||
* PS4} controllers or {@link edu.wpi.first.wpilibj2.command.button.CommandJoystick Flight
|
||||
* joysticks}.
|
||||
*
|
||||
* @return the command to run in autonomous
|
||||
*/
|
||||
public Command getAutonomousCommand() {
|
||||
// An example command will be run in autonomous
|
||||
return Commands.parallel(intakeSubsystem.deploy(), Commands.run(()-> {turretSubsystem.homeTurret();}, turretSubsystem), driveSubsystem.getAutoCommand());
|
||||
}
|
||||
*/
|
||||
private void configureBindings() {
|
||||
m_driverController.povDown().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_STORED_ANGLE));
|
||||
m_driverController.povLeft().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE1));
|
||||
m_driverController.povRight().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE3));
|
||||
m_driverController.povUp().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE2));
|
||||
|
||||
m_driverController.back().whileTrue(new AutoShootCommandChassisTurretPathPlanner(driveSubsystem, hopperSubsystem, turretSubsystem));
|
||||
//m_driverController.a().whileTrue(new AutoShootCommandChassisTurretPathPlanner(driveSubsystem, hopperSubsystem, turretSubsystem));
|
||||
// m_driverController:wa.a().whileTrue(new AutoShootCommandChassisTurret(driveSubsystem, hopperSubsystem, turretSubsystem));
|
||||
|
||||
m_driverController.leftBumper().onTrue(Commands.runOnce(() -> turretSubsystem.homeTurret(), turretSubsystem));
|
||||
m_driverController.rightBumper().onTrue(intakeSubsystem.intake());
|
||||
m_driverController.y().whileTrue(new RelayCommand(hopperSubsystem, turretSubsystem, intakeSubsystem));
|
||||
m_driverController.start().whileTrue(intakeSubsystem.resetDeploy());
|
||||
m_driverController.x().whileTrue(new AutoShootCommandChassisTurret(driveSubsystem, hopperSubsystem, turretSubsystem));
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to pass the autonomous command to the main {@link Robot} class.
|
||||
*
|
||||
* @return the command to run in autonomous
|
||||
*/
|
||||
public Command getAutonomousCommand() {
|
||||
// An example command will be run in autonomous
|
||||
return Commands.parallel(intakeSubsystem.deploy(), Commands.run(() -> {
|
||||
turretSubsystem.homeTurret();
|
||||
}, turretSubsystem), driveSubsystem.getAutoCommand());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,58 +0,0 @@
|
|||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package frc.robot.commands;
|
||||
|
||||
import frc.robot.subsystems.HopperSubsystem;
|
||||
import edu.wpi.first.wpilibj.XboxController;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
|
||||
/** An example command that uses an example subsystem. */
|
||||
public class ManualHopperCommand extends Command {
|
||||
private final HopperSubsystem m_subsystem;
|
||||
private final XboxController m_xboxController;
|
||||
|
||||
public ManualHopperCommand(HopperSubsystem subsystem, XboxController xboxController) {
|
||||
m_subsystem = subsystem;
|
||||
m_xboxController = xboxController;
|
||||
addRequirements(subsystem);
|
||||
}
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {
|
||||
m_subsystem.spindexerOn();
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if(m_xboxController.getLeftTriggerAxis()>.5 && m_xboxController.getRightTriggerAxis()>.2)
|
||||
{
|
||||
m_subsystem.feedKicker();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_subsystem.stopKicker();
|
||||
}
|
||||
if(m_xboxController.getRightBumper())
|
||||
{
|
||||
m_subsystem.spindexerOn();
|
||||
}
|
||||
if(m_xboxController.getLeftBumper())
|
||||
{
|
||||
m_subsystem.spindexerOff();
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue