mirror of
https://github.com/Team4388/2022NoWayHome.git
synced 2026-06-09 00:38:05 -06:00
can now drive while Shoot.java was running
This commit is contained in:
@@ -279,7 +279,7 @@ public final class Constants {
|
|||||||
|
|
||||||
// Shoot Command Constants
|
// Shoot Command Constants
|
||||||
public static final Gains TURRET_SHOOT_GAINS = new Gains(3.0, 0.0, 0.0, 0.0, 0, 1.0);
|
public static final Gains TURRET_SHOOT_GAINS = new Gains(3.0, 0.0, 0.0, 0.0, 0, 1.0);
|
||||||
public static final Gains SWERVE_SHOOT_GAINS = new Gains(4.0, 0.0, 0.0, 0.0, 0, 1.0);
|
public static final Gains SWERVE_SHOOT_GAINS = new Gains(6.0, 0.0, 0.0, 0.0, 0, 1.0);
|
||||||
|
|
||||||
/* Turret Constants */
|
/* Turret Constants */
|
||||||
// ID
|
// ID
|
||||||
|
|||||||
@@ -131,8 +131,8 @@ public class RobotContainer {
|
|||||||
// public final Climber m_robotClimber = new Climber(testShoulderMotor, testElbowMotor);
|
// public final Climber m_robotClimber = new Climber(testShoulderMotor, testElbowMotor);
|
||||||
|
|
||||||
// Controllers
|
// Controllers
|
||||||
private final XboxController m_driverXbox = new DeadbandedXboxController(OIConstants.XBOX_DRIVER_ID);
|
private final static XboxController m_driverXbox = new DeadbandedXboxController(OIConstants.XBOX_DRIVER_ID);
|
||||||
private final XboxController m_operatorXbox = new DeadbandedXboxController(OIConstants.XBOX_OPERATOR_ID);
|
private final static XboxController m_operatorXbox = new DeadbandedXboxController(OIConstants.XBOX_OPERATOR_ID);
|
||||||
private final ButtonBox m_buttonBox = new ButtonBox(OIConstants.BUTTON_BOX_ID);
|
private final ButtonBox m_buttonBox = new ButtonBox(OIConstants.BUTTON_BOX_ID);
|
||||||
|
|
||||||
// Autonomous
|
// Autonomous
|
||||||
@@ -270,31 +270,29 @@ public class RobotContainer {
|
|||||||
new JoystickButton(getDriverController(), XboxController.Button.kRightBumper.value)
|
new JoystickButton(getDriverController(), XboxController.Button.kRightBumper.value)
|
||||||
.whenPressed(() -> m_robotSwerveDrive.highSpeed(true));
|
.whenPressed(() -> m_robotSwerveDrive.highSpeed(true));
|
||||||
|
|
||||||
new JoystickButton(getDriverController(), XboxController.Button.kA.value)
|
// new JoystickButton(getDriverController(), XboxController.Button.kA.value)
|
||||||
.whileHeld(() -> m_robotSwerveDrive.driveWithInput(0.0, 0.0, 0.2, true))
|
// .whileHeld(() -> m_robotSwerveDrive.driveWithInput(0.0, 0.0, 0.2, true))
|
||||||
.whenReleased(() -> m_robotSwerveDrive.stopModules());
|
// .whenReleased(() -> m_robotSwerveDrive.stopModules());
|
||||||
|
|
||||||
new JoystickButton(getDriverController(), XboxController.Button.kB.value)
|
// new JoystickButton(getDriverController(), XboxController.Button.kB.value)
|
||||||
.whileHeld(new AimToCenter(m_robotTurret, m_robotVisionOdometry, m_robotSwerveDrive::getOdometry))
|
// .whileHeld(new AimToCenter(m_robotTurret, m_robotVisionOdometry, m_robotSwerveDrive::getOdometry))
|
||||||
.whenReleased(new InstantCommand(() -> m_robotTurret.runTurretWithInput(0.0), m_robotTurret));
|
// .whenReleased(new InstantCommand(() -> m_robotTurret.runTurretWithInput(0.0), m_robotTurret));
|
||||||
|
|
||||||
// new JoystickButton(getDriverController(), XboxController.Button.kY.value)
|
// new JoystickButton(getDriverController(), XboxController.Button.kY.value)
|
||||||
// .whenPressed(new Shoot(m_robotSwerveDrive, m_robotBoomBoom, m_robotTurret, m_robotHood, false));
|
// .whenPressed(new Shoot(m_robotSwerveDrive, m_robotBoomBoom, m_robotTurret, m_robotHood, false));
|
||||||
// .whenReleased(new InstantCommand(() -> m_robotTurret.runTurretWithInput(0.0), m_robotTurret))
|
// .whenReleased(new InstantCommand(() -> m_robotTurret.runTurretWithInput(0.0), m_robotTurret))
|
||||||
// .whenReleased(() -> m_robotSwerveDrive.stopModules());
|
// .whenReleased(() -> m_robotSwerveDrive.stopModules());
|
||||||
|
|
||||||
new JoystickButton(getDriverController(), XboxController.Button.kX.value)
|
// new JoystickButton(getDriverController(), XboxController.Button.kX.value)
|
||||||
.whileHeld(new TrackTarget(m_robotTurret, m_robotBoomBoom, m_robotHood, m_robotVisionOdometry))
|
// .whileHeld(new TrackTarget(m_robotTurret, m_robotBoomBoom, m_robotHood, m_robotVisionOdometry))
|
||||||
.whenReleased(new InstantCommand(() -> m_robotTurret.runTurretWithInput(0.0), m_robotTurret))
|
// .whenReleased(new InstantCommand(() -> m_robotTurret.runTurretWithInput(0.0), m_robotTurret))
|
||||||
.whenReleased(new InstantCommand(() -> m_robotHood.runHood(0.0), m_robotHood))
|
// .whenReleased(new InstantCommand(() -> m_robotHood.runHood(0.0), m_robotHood))
|
||||||
.whenReleased(new InstantCommand(() -> m_robotBoomBoom.runDrumShooter(0.0), m_robotBoomBoom));
|
// .whenReleased(new InstantCommand(() -> m_robotBoomBoom.runDrumShooter(0.0), m_robotBoomBoom));
|
||||||
|
|
||||||
/* Operator Buttons */
|
/* Operator Buttons */
|
||||||
|
|
||||||
new JoystickButton(getOperatorController(), XboxController.Button.kY.value)
|
new JoystickButton(getOperatorController(), XboxController.Button.kY.value)
|
||||||
.whenPressed(new Shoot(m_robotSwerveDrive, m_robotBoomBoom, m_robotTurret, m_robotHood, false));
|
.whenPressed(new Shoot(m_robotSwerveDrive, m_robotBoomBoom, m_robotTurret, m_robotHood, false));
|
||||||
//!.whenReleased(new InstantCommand(() -> m_robotTurret.runTurretWithInput(0.0), m_robotTurret))
|
|
||||||
//!.whenReleased(() -> m_robotSwerveDrive.stopModules());
|
|
||||||
|
|
||||||
// new JoystickButton(getOperatorController(), XboxController.Button.kY.value)
|
// new JoystickButton(getOperatorController(), XboxController.Button.kY.value)
|
||||||
// .whileHeld(new RunCommand(() -> m_robotClaws.setOpen(true)));
|
// .whileHeld(new RunCommand(() -> m_robotClaws.setOpen(true)));
|
||||||
@@ -340,9 +338,10 @@ public class RobotContainer {
|
|||||||
|
|
||||||
//B > Shoot with Lime
|
//B > Shoot with Lime
|
||||||
new JoystickButton(getOperatorController(), XboxController.Button.kA.value)
|
new JoystickButton(getOperatorController(), XboxController.Button.kA.value)
|
||||||
.whileHeld(new TrackTarget(m_robotTurret, m_robotBoomBoom, m_robotHood, m_robotVisionOdometry))
|
// .whileHeld(new TrackTarget(m_robotTurret, m_robotBoomBoom, m_robotHood, m_robotVisionOdometry))
|
||||||
.whenReleased(new InstantCommand(() -> m_robotVisionOdometry.setLEDs(false)))
|
// .whenReleased(new InstantCommand(() -> m_robotVisionOdometry.setLEDs(false)))
|
||||||
.whenReleased(new RunCommand(() -> m_robotBoomBoom.runDrumShooterVelocityPID(0)));
|
.whenPressed(new RunCommand(() -> m_robotBoomBoom.runDrumShooter(0.25)))
|
||||||
|
.whenReleased(new RunCommand(() -> m_robotBoomBoom.runDrumShooter(0.0)));
|
||||||
// .whileHeld%
|
// .whileHeld%
|
||||||
|
|
||||||
/* Button Box Buttons */
|
/* Button Box Buttons */
|
||||||
@@ -414,11 +413,11 @@ public class RobotContainer {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XboxController getDriverController() {
|
public static XboxController getDriverController() {
|
||||||
return m_driverXbox;
|
return m_driverXbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XboxController getOperatorController() {
|
public static XboxController getOperatorController() {
|
||||||
return m_operatorXbox;
|
return m_operatorXbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import edu.wpi.first.math.geometry.Translation2d;
|
|||||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||||
import frc4388.robot.Constants;
|
import frc4388.robot.Constants;
|
||||||
|
import frc4388.robot.Robot;
|
||||||
|
import frc4388.robot.RobotContainer;
|
||||||
import frc4388.robot.Constants.ShooterConstants;
|
import frc4388.robot.Constants.ShooterConstants;
|
||||||
import frc4388.robot.Constants.SwerveDriveConstants;
|
import frc4388.robot.Constants.SwerveDriveConstants;
|
||||||
import frc4388.robot.subsystems.BoomBoom;
|
import frc4388.robot.subsystems.BoomBoom;
|
||||||
@@ -160,7 +162,7 @@ public class Shoot extends CommandBase {
|
|||||||
|
|
||||||
this.turret.runTurretWithCustomPID(normOutput);
|
this.turret.runTurretWithCustomPID(normOutput);
|
||||||
// this.turret.m_boomBoomRotateMotor.set(normOutput);
|
// this.turret.m_boomBoomRotateMotor.set(normOutput);
|
||||||
this.swerve.driveWithInput(0, 0, normOutput * (this.swerveGains.kP/this.turretGains.kP), false); // ? should the output be field relative
|
this.swerve.driveWithInput(RobotContainer.getDriverController().getLeftX(), RobotContainer.getDriverController().getLeftY(), normOutput * (this.swerveGains.kP/this.turretGains.kP), true); // ? should the output be field relative
|
||||||
|
|
||||||
if (this.toShoot) {
|
if (this.toShoot) {
|
||||||
this.hood.runAngleAdjustPID(this.targetHood);
|
this.hood.runAngleAdjustPID(this.targetHood);
|
||||||
|
|||||||
@@ -189,7 +189,8 @@ public class BoomBoom extends SubsystemBase {
|
|||||||
* @param speed percent output form -1.0 to 1.0
|
* @param speed percent output form -1.0 to 1.0
|
||||||
*/
|
*/
|
||||||
public void runDrumShooter(double speed) {
|
public void runDrumShooter(double speed) {
|
||||||
m_shooterFalconLeft.set(TalonFXControlMode.PercentOutput, speed + speed2);
|
// m_shooterFalconLeft.set(TalonFXControlMode.PercentOutput, speed + speed2);
|
||||||
|
m_shooterFalconLeft.set(speed);
|
||||||
SmartDashboard.putNumber("BoomBoom percent speed", speed + speed2);
|
SmartDashboard.putNumber("BoomBoom percent speed", speed + speed2);
|
||||||
SmartDashboard.putNumber("BoomBoom current stator", m_shooterFalconLeft.getStatorCurrent());
|
SmartDashboard.putNumber("BoomBoom current stator", m_shooterFalconLeft.getStatorCurrent());
|
||||||
SmartDashboard.putNumber("BoomBoom current supply", m_shooterFalconLeft.getSupplyCurrent());
|
SmartDashboard.putNumber("BoomBoom current supply", m_shooterFalconLeft.getSupplyCurrent());
|
||||||
|
|||||||
Reference in New Issue
Block a user