Worked on the barge shot, added a consistent coral intake

This commit is contained in:
Team 2648 2025-03-20 19:00:37 -04:00
parent 50f402f36f
commit 3e6fa986e7
4 changed files with 12 additions and 3 deletions

View File

@ -143,6 +143,8 @@ public class RobotContainer {
driver.leftTrigger().whileTrue( driver.leftTrigger().whileTrue(
manipulator.runUntilCollected(() -> 0.75) manipulator.runUntilCollected(() -> 0.75)
.until(() -> manipulator.getCoralBeamBreak() == false)
.andThen(manipulator.retractCommand(() -> .1))
); );
driver.start().and(driver.back()).onTrue( driver.start().and(driver.back()).onTrue(
@ -495,7 +497,7 @@ public class RobotContainer {
private Command shootAlgae(){ private Command shootAlgae(){
return manipulatorPivot.goToSetpoint(() -> ManipulatorPivotConstants.kBargeShotPosition) return manipulatorPivot.goToSetpoint(() -> ManipulatorPivotConstants.kBargeShotPosition)
.andThen(elevator.goToSetpoint(() -> ElevatorConstants.kL4Position), manipulatorPivot.goToSetpoint(() -> ManipulatorPivotConstants.kBargeShotPosition) .andThen(elevator.goToSetpoint(() -> ElevatorConstants.kL4Position), manipulatorPivot.goToSetpoint(() -> ManipulatorPivotConstants.kBargeShotPosition)
.raceWith(elevator.maintainPosition())).until(() -> elevator.getEncoderPosition()>30).andThen(manipulator.runManipulator(() -> -1, false), .raceWith(elevator.maintainPosition())).until(() -> elevator.getEncoderPosition()>44).andThen(manipulator.runManipulator(() -> -1, false),
elevator.goToSetpoint(() -> ElevatorConstants.kL4Position), manipulatorPivot.goToSetpoint(() -> ManipulatorPivotConstants.kBargeShotPosition) elevator.goToSetpoint(() -> ElevatorConstants.kL4Position), manipulatorPivot.goToSetpoint(() -> ManipulatorPivotConstants.kBargeShotPosition)
.raceWith(elevator.maintainPosition())); .raceWith(elevator.maintainPosition()));
} }

View File

@ -1,5 +1,6 @@
package frc.robot.constants; package frc.robot.constants;
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;
import com.revrobotics.spark.config.SparkMaxConfig; import com.revrobotics.spark.config.SparkMaxConfig;
public class ManipulatorConstants { public class ManipulatorConstants {
@ -7,4 +8,9 @@ public class ManipulatorConstants {
public static final int kCoralBeamBreakID = 2; public static final int kCoralBeamBreakID = 2;
public static final SparkMaxConfig motorConfig = new SparkMaxConfig(); public static final SparkMaxConfig motorConfig = new SparkMaxConfig();
static{
motorConfig.smartCurrentLimit(40)
.idleMode(IdleMode.kBrake);
};
} }

View File

@ -20,7 +20,7 @@ public class ManipulatorPivotConstants {
public static final double kPivotMaxVelocity = 2 * Math.PI; public static final double kPivotMaxVelocity = 2 * Math.PI;
public static final double kPositionalP = 4; public static final double kPositionalP = 4.5;
public static final double kPositionalI = 0; public static final double kPositionalI = 0;
public static final double kPositionalD = 0; public static final double kPositionalD = 0;
public static final double kPositionalTolerance = Units.degreesToRadians(1.5); public static final double kPositionalTolerance = Units.degreesToRadians(1.5);

View File

@ -71,7 +71,8 @@ public class Manipulator extends SubsystemBase {
manipulatorMotor.set( manipulatorMotor.set(
speed.getAsDouble() speed.getAsDouble()
); );
}).until(() -> !coralBeamBreak.get()); }).unless(() -> !coralBeamBreak.get())
.until(() -> !coralBeamBreak.get());
} }
public Command retractCommand(DoubleSupplier retractSpeed){ public Command retractCommand(DoubleSupplier retractSpeed){