From fd619129b9b86179af5051ee5af713c34581aaa1 Mon Sep 17 00:00:00 2001 From: Keon Date: Wed, 7 Jul 2021 22:15:43 -0400 Subject: [PATCH 01/13] Add July HEAT auto mode - shoot then drive forward --- src/main/java/frc/robot/RobotContainer.java | 20 ++++++ .../shooterCommands/SpinUpShooterCommand.java | 62 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 src/main/java/frc/robot/commands/shooterCommands/SpinUpShooterCommand.java diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 0a5d0ed..f92439a 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -32,6 +32,7 @@ import frc.robot.commands.shooterCommands.ConstantShootCommand; import frc.robot.commands.shooterCommands.MaxPowerShootCommand; import frc.robot.commands.shooterCommands.PidShootCommand; +import frc.robot.commands.shooterCommands.SpinUpShooterCommand; import frc.robot.commands.drivingCommands.DisableRampingCommand; import frc.robot.commands.drivingCommands.DriveEncoders; import frc.robot.commands.drivingCommands.EnableBrakeModeCommand; @@ -77,6 +78,7 @@ public class RobotContainer { enum PossibleAutos { IN_FRONT_OF_TARGET_MAX_POWER, IN_FRONT_OF_TARGET_MAX_POWER_THEN_BACK, + JULY_HEAT, } SendableChooser autoChoice = new SendableChooser(); @@ -238,6 +240,8 @@ public Command getAutonomousCommand() { return getAutoInFrontOfTarget(); case IN_FRONT_OF_TARGET_MAX_POWER_THEN_BACK: return getAutoInFrontOfTargetThenBack(); + case JULY_HEAT: + return getAutoModeJulyHeat(); default: return null; } @@ -274,6 +278,22 @@ private Command getAutoInFrontOfTargetThenBack() { .andThen((shoot.withTimeout(5)).andThen(driveBack)); } + private Command getAutoModeJulyHeat() { + // This command drives forward 4 feet when run + Command driveForward = new DriveEncoders(1.2192, .5, driveTrain); + // This spins up the shooter - note: it doesn't stop the shooter, which might be concerning + Command spinUp = new SpinUpShooterCommand(shooter, 1, 1); + // This shoots with PID - We should adjust the value to the setpoint at wherever we start the bot + Command shoot = new PidShootCommand(shooter, 1, 1); + // This indexes the horizontal indexer in + Command horizIn = new HorizontalIndexerIntakeCommand(horizontalIndexer); + // This indexes the vertical indexer up + Command vertUp = new VerticalIndexerUpCommand(verticalIndexer); + + //This lets the shooter spin, then keeps it spinning and indexes up for 5 seconds to allow all balls to be shot, then drives forwards. Times can be adjusted as needed + return spinUp.andThen((shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)).andThen(driveForward)); + } + public Command getStopDriveTrainCommand() { return new StopDrivetrainCommand(driveTrain); } diff --git a/src/main/java/frc/robot/commands/shooterCommands/SpinUpShooterCommand.java b/src/main/java/frc/robot/commands/shooterCommands/SpinUpShooterCommand.java new file mode 100644 index 0000000..8aecf42 --- /dev/null +++ b/src/main/java/frc/robot/commands/shooterCommands/SpinUpShooterCommand.java @@ -0,0 +1,62 @@ +// 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. + +/*Note - this command works just like PidShootCommand with 3 changes: 1. It stops when the shooter is at the speed. 2. It doesn't stop the shooter when it ends +3. It prints to smart dashboard with a different prefix. Change 2 might be problematic +*/ + +package frc.robot.commands.shooterCommands; + +import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; +import edu.wpi.first.wpilibj2.command.CommandBase; +import frc.robot.subsystems.ShooterSubsystem; + +public class SpinUpShooterCommand extends CommandBase { + ShooterSubsystem shooter; + double topVelocityFraction; + double bottomVelocityFraction; + /** Creates a new SpinUpShooterCommand. */ + public SpinUpShooterCommand(ShooterSubsystem shooter, double topVelocityFraction, double bottomVelocityFraction) { + this.shooter = shooter; + this.topVelocityFraction = topVelocityFraction; + this.bottomVelocityFraction = bottomVelocityFraction; + // Use addRequirements() here to declare subsystem dependencies. + addRequirements(shooter); + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + double topShootingVelocityFraction = + SmartDashboard.getNumber("Commands.SpinUpShooter.topSpeedFraction", this.topVelocityFraction); + SmartDashboard.putNumber("Commands.SpinUpShooter.topSpeedFraction", topShootingVelocityFraction); + double bottomShootingVelocityFraction = + SmartDashboard.getNumber( + "Commands.SpinUpShooter.BottomSpeedFraction", this.bottomVelocityFraction); + SmartDashboard.putNumber( + "Commands.SpinUpShooter.BottomSpeedFraction", bottomShootingVelocityFraction); + + shooter.setMotorVelocities(topVelocityFraction, bottomVelocityFraction); + } + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + // Update it every time to ensure that it keeps working - there was some weirdness this helped + // fix + SmartDashboard.putNumber("Commands.SpinUpShooter.topSpeedFraction", topVelocityFraction); + SmartDashboard.putNumber("Commands.SpinUpShooter.BottomSpeedFraction", bottomVelocityFraction); + shooter.setMotorVelocities(topVelocityFraction, bottomVelocityFraction); + } + + // 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 shooter.isShooterReady(); + } +} From e150a69bcf844672df287279427955a9cd2a2f12 Mon Sep 17 00:00:00 2001 From: github-actions <> Date: Thu, 8 Jul 2021 02:16:31 +0000 Subject: [PATCH 02/13] Google Java Format --- src/main/java/frc/robot/RobotContainer.java | 9 ++++++--- .../commands/shooterCommands/SpinUpShooterCommand.java | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index f92439a..c8791f0 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -283,15 +283,18 @@ private Command getAutoModeJulyHeat() { Command driveForward = new DriveEncoders(1.2192, .5, driveTrain); // This spins up the shooter - note: it doesn't stop the shooter, which might be concerning Command spinUp = new SpinUpShooterCommand(shooter, 1, 1); - // This shoots with PID - We should adjust the value to the setpoint at wherever we start the bot + // This shoots with PID - We should adjust the value to the setpoint at wherever we start the + // bot Command shoot = new PidShootCommand(shooter, 1, 1); // This indexes the horizontal indexer in Command horizIn = new HorizontalIndexerIntakeCommand(horizontalIndexer); // This indexes the vertical indexer up Command vertUp = new VerticalIndexerUpCommand(verticalIndexer); - //This lets the shooter spin, then keeps it spinning and indexes up for 5 seconds to allow all balls to be shot, then drives forwards. Times can be adjusted as needed - return spinUp.andThen((shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)).andThen(driveForward)); + // This lets the shooter spin, then keeps it spinning and indexes up for 5 seconds to allow all + // balls to be shot, then drives forwards. Times can be adjusted as needed + return spinUp.andThen( + (shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)).andThen(driveForward)); } public Command getStopDriveTrainCommand() { diff --git a/src/main/java/frc/robot/commands/shooterCommands/SpinUpShooterCommand.java b/src/main/java/frc/robot/commands/shooterCommands/SpinUpShooterCommand.java index 8aecf42..8a87371 100644 --- a/src/main/java/frc/robot/commands/shooterCommands/SpinUpShooterCommand.java +++ b/src/main/java/frc/robot/commands/shooterCommands/SpinUpShooterCommand.java @@ -17,7 +17,8 @@ public class SpinUpShooterCommand extends CommandBase { double topVelocityFraction; double bottomVelocityFraction; /** Creates a new SpinUpShooterCommand. */ - public SpinUpShooterCommand(ShooterSubsystem shooter, double topVelocityFraction, double bottomVelocityFraction) { + public SpinUpShooterCommand( + ShooterSubsystem shooter, double topVelocityFraction, double bottomVelocityFraction) { this.shooter = shooter; this.topVelocityFraction = topVelocityFraction; this.bottomVelocityFraction = bottomVelocityFraction; @@ -29,8 +30,10 @@ public SpinUpShooterCommand(ShooterSubsystem shooter, double topVelocityFraction @Override public void initialize() { double topShootingVelocityFraction = - SmartDashboard.getNumber("Commands.SpinUpShooter.topSpeedFraction", this.topVelocityFraction); - SmartDashboard.putNumber("Commands.SpinUpShooter.topSpeedFraction", topShootingVelocityFraction); + SmartDashboard.getNumber( + "Commands.SpinUpShooter.topSpeedFraction", this.topVelocityFraction); + SmartDashboard.putNumber( + "Commands.SpinUpShooter.topSpeedFraction", topShootingVelocityFraction); double bottomShootingVelocityFraction = SmartDashboard.getNumber( "Commands.SpinUpShooter.BottomSpeedFraction", this.bottomVelocityFraction); From 7530a8e667b2849487782d87531b172020d93823 Mon Sep 17 00:00:00 2001 From: Keon Date: Thu, 8 Jul 2021 22:15:28 -0400 Subject: [PATCH 03/13] Add pointing turret, and autonomous to drive forward --- src/main/java/frc/robot/RobotContainer.java | 22 ++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index f92439a..83e3140 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -78,7 +78,8 @@ public class RobotContainer { enum PossibleAutos { IN_FRONT_OF_TARGET_MAX_POWER, IN_FRONT_OF_TARGET_MAX_POWER_THEN_BACK, - JULY_HEAT, + SHOOT_THEN_DRIVE_JULY_HEAT, + DRIVE_JULY_HEAT, } SendableChooser autoChoice = new SendableChooser(); @@ -240,8 +241,10 @@ public Command getAutonomousCommand() { return getAutoInFrontOfTarget(); case IN_FRONT_OF_TARGET_MAX_POWER_THEN_BACK: return getAutoInFrontOfTargetThenBack(); - case JULY_HEAT: - return getAutoModeJulyHeat(); + case SHOOT_THEN_DRIVE_JULY_HEAT: + return getAutoShootThenDriveJulyHEAT(); + case DRIVE_JULY_HEAT: + return getAutoDriveJulyHEAT(); default: return null; } @@ -278,20 +281,29 @@ private Command getAutoInFrontOfTargetThenBack() { .andThen((shoot.withTimeout(5)).andThen(driveBack)); } - private Command getAutoModeJulyHeat() { + private Command getAutoShootThenDriveJulyHEAT() { // This command drives forward 4 feet when run Command driveForward = new DriveEncoders(1.2192, .5, driveTrain); // This spins up the shooter - note: it doesn't stop the shooter, which might be concerning Command spinUp = new SpinUpShooterCommand(shooter, 1, 1); // This shoots with PID - We should adjust the value to the setpoint at wherever we start the bot Command shoot = new PidShootCommand(shooter, 1, 1); + // This aims the turret + Command aimTurret = new PointTurretAtTargetWithAngleCommand(turret); // This indexes the horizontal indexer in Command horizIn = new HorizontalIndexerIntakeCommand(horizontalIndexer); // This indexes the vertical indexer up Command vertUp = new VerticalIndexerUpCommand(verticalIndexer); //This lets the shooter spin, then keeps it spinning and indexes up for 5 seconds to allow all balls to be shot, then drives forwards. Times can be adjusted as needed - return spinUp.andThen((shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)).andThen(driveForward)); + return aimTurret.alongWith(spinUp.andThen((shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)).andThen(driveForward))); + } + + private Command getAutoDriveJulyHEAT() { + // This command drives forward 4 feet when run + Command driveForward = new DriveEncoders(1.2192, .5, driveTrain); + + return driveForward; } public Command getStopDriveTrainCommand() { From e31871dd159aa26dc09de165130b29503107945e Mon Sep 17 00:00:00 2001 From: github-actions <> Date: Fri, 9 Jul 2021 02:16:57 +0000 Subject: [PATCH 04/13] Google Java Format --- src/main/java/frc/robot/RobotContainer.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 40b72d4..5317a1e 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -296,8 +296,11 @@ private Command getAutoShootThenDriveJulyHEAT() { // This indexes the vertical indexer up Command vertUp = new VerticalIndexerUpCommand(verticalIndexer); - //This lets the shooter spin, then keeps it spinning and indexes up for 5 seconds to allow all balls to be shot, then drives forwards. Times can be adjusted as needed - return aimTurret.alongWith(spinUp.andThen((shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)).andThen(driveForward))); + // This lets the shooter spin, then keeps it spinning and indexes up for 5 seconds to allow all + // balls to be shot, then drives forwards. Times can be adjusted as needed + return aimTurret.alongWith( + spinUp.andThen( + (shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)).andThen(driveForward))); } private Command getAutoDriveJulyHEAT() { From a09efc115bfe4fdc9ceff183c4f3edd670ee4cf0 Mon Sep 17 00:00:00 2001 From: Keon Date: Thu, 8 Jul 2021 22:17:09 -0400 Subject: [PATCH 05/13] Add comment --- src/main/java/frc/robot/RobotContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 40b72d4..3755b99 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -296,7 +296,7 @@ private Command getAutoShootThenDriveJulyHEAT() { // This indexes the vertical indexer up Command vertUp = new VerticalIndexerUpCommand(verticalIndexer); - //This lets the shooter spin, then keeps it spinning and indexes up for 5 seconds to allow all balls to be shot, then drives forwards. Times can be adjusted as needed + //This lets the shooter spin, then keeps it spinning and indexes up for 5 seconds to allow all balls to be shot, then drives forwards. While it does this the turret aims. Times can be adjusted as needed return aimTurret.alongWith(spinUp.andThen((shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)).andThen(driveForward))); } From c4568913b7ca8c170cc17091e8bd8bb8682c497c Mon Sep 17 00:00:00 2001 From: github-actions <> Date: Fri, 9 Jul 2021 02:19:24 +0000 Subject: [PATCH 06/13] Google Java Format --- src/main/java/frc/robot/RobotContainer.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 3755b99..cf761de 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -296,8 +296,12 @@ private Command getAutoShootThenDriveJulyHEAT() { // This indexes the vertical indexer up Command vertUp = new VerticalIndexerUpCommand(verticalIndexer); - //This lets the shooter spin, then keeps it spinning and indexes up for 5 seconds to allow all balls to be shot, then drives forwards. While it does this the turret aims. Times can be adjusted as needed - return aimTurret.alongWith(spinUp.andThen((shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)).andThen(driveForward))); + // This lets the shooter spin, then keeps it spinning and indexes up for 5 seconds to allow all + // balls to be shot, then drives forwards. While it does this the turret aims. Times can be + // adjusted as needed + return aimTurret.alongWith( + spinUp.andThen( + (shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)).andThen(driveForward))); } private Command getAutoDriveJulyHEAT() { From 661c6b5209fe831940f3213349f87da416dde04b Mon Sep 17 00:00:00 2001 From: Keon Date: Fri, 9 Jul 2021 20:39:33 -0400 Subject: [PATCH 07/13] Fix errors in spin up shooter --- .../SpinUpShooterCommand.java | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/main/java/frc/robot/commands/hoodedShooterCommands/SpinUpShooterCommand.java b/src/main/java/frc/robot/commands/hoodedShooterCommands/SpinUpShooterCommand.java index 8a87371..ce0be2a 100644 --- a/src/main/java/frc/robot/commands/hoodedShooterCommands/SpinUpShooterCommand.java +++ b/src/main/java/frc/robot/commands/hoodedShooterCommands/SpinUpShooterCommand.java @@ -6,22 +6,20 @@ 3. It prints to smart dashboard with a different prefix. Change 2 might be problematic */ -package frc.robot.commands.shooterCommands; +package frc.robot.commands.hoodedShooterCommands; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj2.command.CommandBase; -import frc.robot.subsystems.ShooterSubsystem; +import frc.robot.subsystems.HoodedShooterSubsystem; public class SpinUpShooterCommand extends CommandBase { - ShooterSubsystem shooter; - double topVelocityFraction; - double bottomVelocityFraction; + HoodedShooterSubsystem shooter; + double velocityFraction; /** Creates a new SpinUpShooterCommand. */ public SpinUpShooterCommand( - ShooterSubsystem shooter, double topVelocityFraction, double bottomVelocityFraction) { + HoodedShooterSubsystem shooter, double velocityFraction) { this.shooter = shooter; - this.topVelocityFraction = topVelocityFraction; - this.bottomVelocityFraction = bottomVelocityFraction; + this.velocityFraction = velocityFraction; // Use addRequirements() here to declare subsystem dependencies. addRequirements(shooter); } @@ -29,18 +27,14 @@ public SpinUpShooterCommand( // Called when the command is initially scheduled. @Override public void initialize() { - double topShootingVelocityFraction = + double shootingVelocityFraction = SmartDashboard.getNumber( - "Commands.SpinUpShooter.topSpeedFraction", this.topVelocityFraction); + "Commands.SpinUpShooter.topSpeedFraction", this.velocityFraction); SmartDashboard.putNumber( - "Commands.SpinUpShooter.topSpeedFraction", topShootingVelocityFraction); - double bottomShootingVelocityFraction = - SmartDashboard.getNumber( - "Commands.SpinUpShooter.BottomSpeedFraction", this.bottomVelocityFraction); - SmartDashboard.putNumber( - "Commands.SpinUpShooter.BottomSpeedFraction", bottomShootingVelocityFraction); + "Commands.SpinUpShooter.topSpeedFraction", shootingVelocityFraction); + - shooter.setMotorVelocities(topVelocityFraction, bottomVelocityFraction); + shooter.setShooterVelFraction(velocityFraction); } // Called every time the scheduler runs while the command is scheduled. @@ -48,9 +42,8 @@ public void initialize() { public void execute() { // Update it every time to ensure that it keeps working - there was some weirdness this helped // fix - SmartDashboard.putNumber("Commands.SpinUpShooter.topSpeedFraction", topVelocityFraction); - SmartDashboard.putNumber("Commands.SpinUpShooter.BottomSpeedFraction", bottomVelocityFraction); - shooter.setMotorVelocities(topVelocityFraction, bottomVelocityFraction); + SmartDashboard.putNumber("Commands.SpinUpShooter.speedFraction", velocityFraction); + shooter.setShooterVelFraction(velocityFraction); } // Called once the command ends or is interrupted. From 419352e382ea96f1a8080b6812f0a5366800cfd7 Mon Sep 17 00:00:00 2001 From: github-actions <> Date: Sat, 10 Jul 2021 00:40:13 +0000 Subject: [PATCH 08/13] Google Java Format --- .../hoodedShooterCommands/SpinUpShooterCommand.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/frc/robot/commands/hoodedShooterCommands/SpinUpShooterCommand.java b/src/main/java/frc/robot/commands/hoodedShooterCommands/SpinUpShooterCommand.java index ce0be2a..77342ff 100644 --- a/src/main/java/frc/robot/commands/hoodedShooterCommands/SpinUpShooterCommand.java +++ b/src/main/java/frc/robot/commands/hoodedShooterCommands/SpinUpShooterCommand.java @@ -16,8 +16,7 @@ public class SpinUpShooterCommand extends CommandBase { HoodedShooterSubsystem shooter; double velocityFraction; /** Creates a new SpinUpShooterCommand. */ - public SpinUpShooterCommand( - HoodedShooterSubsystem shooter, double velocityFraction) { + public SpinUpShooterCommand(HoodedShooterSubsystem shooter, double velocityFraction) { this.shooter = shooter; this.velocityFraction = velocityFraction; // Use addRequirements() here to declare subsystem dependencies. @@ -28,11 +27,8 @@ public SpinUpShooterCommand( @Override public void initialize() { double shootingVelocityFraction = - SmartDashboard.getNumber( - "Commands.SpinUpShooter.topSpeedFraction", this.velocityFraction); - SmartDashboard.putNumber( - "Commands.SpinUpShooter.topSpeedFraction", shootingVelocityFraction); - + SmartDashboard.getNumber("Commands.SpinUpShooter.topSpeedFraction", this.velocityFraction); + SmartDashboard.putNumber("Commands.SpinUpShooter.topSpeedFraction", shootingVelocityFraction); shooter.setShooterVelFraction(velocityFraction); } From bef608ea3498b633db8242a7bf210e7aef25609d Mon Sep 17 00:00:00 2001 From: Keon Date: Fri, 9 Jul 2021 21:39:40 -0400 Subject: [PATCH 09/13] Update auto mode --- src/main/java/frc/robot/RobotContainer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 4312b51..431e30c 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -285,10 +285,10 @@ private Command getAutoShootThenDriveJulyHEAT() { // This command drives forward 4 feet when run Command driveForward = new DriveEncoders(1.2192, .5, driveTrain); // This spins up the shooter - note: it doesn't stop the shooter, which might be concerning - Command spinUp = new SpinUpShooterCommand(shooter, 1, 1); + Command spinUp = new SpinUpShooterCommand(shooter, 0.37); // This shoots with PID - We should adjust the value to the setpoint at wherever we start the // bot - Command shoot = new PidShootCommand(shooter, 1, 1); + Command shoot = new PidShootCommand(shooter, 0.37); // This aims the turret Command aimTurret = new PointTurretAtTargetWithAngleCommand(turret); // This indexes the horizontal indexer in From 70d3083c6ea45924d2cb0f6ac3cee6ca74e472dc Mon Sep 17 00:00:00 2001 From: Keon Date: Fri, 9 Jul 2021 21:40:45 -0400 Subject: [PATCH 10/13] Make shooter speed a variable for Auto --- src/main/java/frc/robot/RobotContainer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 431e30c..a6519c5 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -282,13 +282,15 @@ private Command getAutoInFrontOfTargetThenBack() { } private Command getAutoShootThenDriveJulyHEAT() { + // This is the speed the shooter will spin + double shooterSpeed = 0.37; // This command drives forward 4 feet when run Command driveForward = new DriveEncoders(1.2192, .5, driveTrain); // This spins up the shooter - note: it doesn't stop the shooter, which might be concerning - Command spinUp = new SpinUpShooterCommand(shooter, 0.37); + Command spinUp = new SpinUpShooterCommand(shooter, shooterSpeed); // This shoots with PID - We should adjust the value to the setpoint at wherever we start the // bot - Command shoot = new PidShootCommand(shooter, 0.37); + Command shoot = new PidShootCommand(shooter, shooterSpeed); // This aims the turret Command aimTurret = new PointTurretAtTargetWithAngleCommand(turret); // This indexes the horizontal indexer in From c883d8f686d9d9f2c47d5c13c6af53b5d72e5b16 Mon Sep 17 00:00:00 2001 From: Keon Date: Sat, 10 Jul 2021 07:58:35 -0400 Subject: [PATCH 11/13] Add a thing to turn 180 --- src/main/java/frc/robot/RobotContainer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index a6519c5..a875f68 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -39,6 +39,7 @@ import frc.robot.commands.drivingCommands.SetSpeedMode; import frc.robot.commands.drivingCommands.StopDrivetrainCommand; import frc.robot.commands.drivingCommands.TankDriveCommand; +import frc.robot.commands.drivingCommands.TurnCommand; import frc.robot.commands.drivingCommands.GTADriveCommand; import frc.robot.subsystems.ClimberSubsystem; import frc.robot.subsystems.DriveTrainSubsystem; @@ -286,6 +287,8 @@ private Command getAutoShootThenDriveJulyHEAT() { double shooterSpeed = 0.37; // This command drives forward 4 feet when run Command driveForward = new DriveEncoders(1.2192, .5, driveTrain); + // Turns around 180 degrees + Command turnAround = new TurnCommand(180, .5, driveTrain, navigation); // This spins up the shooter - note: it doesn't stop the shooter, which might be concerning Command spinUp = new SpinUpShooterCommand(shooter, shooterSpeed); // This shoots with PID - We should adjust the value to the setpoint at wherever we start the @@ -303,7 +306,7 @@ private Command getAutoShootThenDriveJulyHEAT() { // adjusted as needed return aimTurret.alongWith( spinUp.andThen( - (shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)).andThen(driveForward))); + (shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)).andThen(turnAround.andThen(driveForward)))); } private Command getAutoDriveJulyHEAT() { From c0f186505f545b73638aec216aa81be57cdd6640 Mon Sep 17 00:00:00 2001 From: Keon Date: Sat, 10 Jul 2021 07:59:35 -0400 Subject: [PATCH 12/13] Make it 175 to avoid weirdness with rollover --- src/main/java/frc/robot/RobotContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index a875f68..d1df887 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -288,7 +288,7 @@ private Command getAutoShootThenDriveJulyHEAT() { // This command drives forward 4 feet when run Command driveForward = new DriveEncoders(1.2192, .5, driveTrain); // Turns around 180 degrees - Command turnAround = new TurnCommand(180, .5, driveTrain, navigation); + Command turnAround = new TurnCommand(175, .5, driveTrain, navigation); // This spins up the shooter - note: it doesn't stop the shooter, which might be concerning Command spinUp = new SpinUpShooterCommand(shooter, shooterSpeed); // This shoots with PID - We should adjust the value to the setpoint at wherever we start the From c48fc69e4ebb5655ab34483f4a1ff2b60756b85d Mon Sep 17 00:00:00 2001 From: github-actions <> Date: Sat, 10 Jul 2021 12:00:36 +0000 Subject: [PATCH 13/13] Google Java Format --- src/main/java/frc/robot/RobotContainer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index d1df887..0db4e64 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -306,7 +306,8 @@ private Command getAutoShootThenDriveJulyHEAT() { // adjusted as needed return aimTurret.alongWith( spinUp.andThen( - (shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)).andThen(turnAround.andThen(driveForward)))); + (shoot.alongWith(horizIn.alongWith(vertUp)).withTimeout(5)) + .andThen(turnAround.andThen(driveForward)))); } private Command getAutoDriveJulyHEAT() {