hood.setFieldRelativeTarget(Rotation2d.fromDegrees(ShotInterpolation.newHoodMap.get(distanceFromTarget)), hoodVelocity);
}
-
double x = drivepose.getX(); // compared as meters
double y = drivepose.getY();
+
// if (FieldConstants.underTrench(x, y)) {
// System.out.println("Hood forced down");
// } else {
public static final double ladderRedRight = FIELD_WIDTH - 35.75;
public static final double ladderBlueRight = FIELD_WIDTH + 35.75;
+ public static final double TRENCH_CENTER_CHANNEL_WIDTH_INCHES = 50.0;
+ public static final double TRENCH_X_MIN_INCHES = 152.5;
+ public static final double TRENCH_X_MAX_INCHES = 187.5;
+
public static final Zone neutralStrip = new Zone(centerLengthLine, centerWidthLine, rightNeutralLine - leftNeutralLine, redLine - blueLine);
public static final Zone neutralLeft = new Zone(centerLengthLine, centerWidthLine, rightNeutralLine - leftNeutralLine, redLine - blueLine);
public static final Zone neutralRight = new Zone(centerLengthLine, centerWidthLine, rightNeutralLine - leftNeutralLine, redLine - blueLine);
public static boolean underTrench(double x, double y) {
// ensures we aren't in center channel
- if (y > Units.inchesToMeters(50.0) && y < FIELD_WIDTH - Units.inchesToMeters(50)) {
+ if (y > Units.inchesToMeters(TRENCH_CENTER_CHANNEL_WIDTH_INCHES) && y < FIELD_WIDTH - Units.inchesToMeters(TRENCH_CENTER_CHANNEL_WIDTH_INCHES)) {
return false;
}
// if our location is to far away from right underneath trench in terms of x
// in between blue alliance trench
- if (!(x > Units.inchesToMeters(152.5) && x < Units.inchesToMeters(187.5)) && !(x < FIELD_LENGTH - Units.inchesToMeters(152.5) && x > FIELD_LENGTH - Units.inchesToMeters(187.5))) {
+ if (!(x > Units.inchesToMeters(TRENCH_X_MIN_INCHES) && x < Units.inchesToMeters(TRENCH_X_MAX_INCHES)) && !(x < FIELD_LENGTH - Units.inchesToMeters(TRENCH_X_MIN_INCHES) && x > FIELD_LENGTH - Units.inchesToMeters(TRENCH_X_MAX_INCHES))) {
return false;
}
return true;
private Hood hood;
private Intake intake;
private Spindexer spindexer;
- private LinearClimb climb;
public PS5ControllerDriverConfig(
Drivetrain drive,
this.hood = hood;
this.intake = intake;
this.spindexer = spindexer;
- this.climb = climb;
}
public void configureControls() {
.alongWith(new InstantCommand(()-> intakeBoolean = true)));
// Calibration: you can now calibrate easily using this button
- controller.get(PS5Button.PS).onTrue(new InstantCommand(() -> {
- intake.calibrate();
- hood.calibrate();
- })).onFalse(new InstantCommand(() -> {
- intake.stopCalibrating();
- hood.stopCalibrating();
- }, intake, hood));
+ if (hood != null && intake != null) {
+ controller.get(PS5Button.PS).onTrue(new InstantCommand(() -> {
+ intake.calibrate();
+ hood.calibrate();
+ }, intake, hood)).onFalse(new InstantCommand(() -> {
+ intake.stopCalibrating();
+ hood.stopCalibrating();
+ }, intake, hood));
+ }
// Stop intake roller
controller.get(DPad.DOWN).onTrue(new InstantCommand(()->{
}
// Auto shoot
- if (turret != null && hood != null && shooter != null) {
+ if (turret != null && hood != null && shooter != null && spindexer != null) {
autoShoot = new Superstructure(turret, getDrivetrain(), hood, shooter, spindexer);
controller.get(PS5Button.SQUARE).toggleOnTrue(autoShoot);
}
// goalAngle = Rotation2d.fromDegrees(SmartDashboard.getNumber("Hood Setpoint", goalAngle.getDegrees()));
// SmartDashboard.putNumber("Hood Setpoint", goalAngle.getDegrees());
- if (forceHoodDown){
+ if (forceHoodDown) {
goalAngle = Rotation2d.fromDegrees(HoodConstants.MAX_ANGLE);
goalVelocityRadPerSec = 0.0;
- } else {
}
double setpointRad = goalAngle.getRadians();