Skip to content

Commit 876e327

Browse files
author
Roberts Kalnins
committed
Add pre elims changes
1 parent 04dd42e commit 876e327

File tree

7 files changed

+16
-14
lines changed

7 files changed

+16
-14
lines changed
24 Bytes
Binary file not shown.

src/main/java/frc/team2767/deepspace/command/approach/VisionAutoAlignPickupCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ public class VisionAutoAlignPickupCommand extends Command {
2424
private static final double MIN_RANGE = 35.0;
2525
private static final double FWD_SCALE = 0.5;
2626
private static final double FWD_SCALE_FAST = 0.5;
27-
private static final double AUTON_OUTPUT = 0.35;
27+
private static final double AUTON_OUTPUT = 0.30;
2828

2929
private static final DriveSubsystem DRIVE = Robot.DRIVE;
3030
private static final VisionSubsystem VISION = Robot.VISION;
31+
3132
private final ExpoScale driveExpo;
3233
private final Logger logger = LoggerFactory.getLogger(this.getClass());
3334
private double range;
@@ -46,6 +47,7 @@ public VisionAutoAlignPickupCommand() {
4647

4748
@Override
4849
protected void initialize() {
50+
VISION.queryPyeye();
4951
isAuton = DriverStation.getInstance().isAutonomous();
5052
SmartDashboard.putBoolean("Game/haveHatch", false);
5153
logger.info("Begin Vision Auto Align Pickup");

src/main/java/frc/team2767/deepspace/command/approach/VisionAutoAlignPlaceCommand.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package frc.team2767.deepspace.command.approach;
22

3-
import edu.wpi.first.wpilibj.DriverStation;
43
import edu.wpi.first.wpilibj.command.Command;
54
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
65
import frc.team2767.deepspace.Robot;
@@ -29,14 +28,10 @@ public class VisionAutoAlignPlaceCommand extends Command {
2928
private static Controls CONTROLS;
3029
private final Logger logger = LoggerFactory.getLogger(this.getClass());
3130
private AutoPlaceSideChooser autoPlaceSideChooser = new AutoPlaceSideChooser();
32-
private double gyroOffset;
3331
private double range;
3432
private double forward;
35-
private double strafeError;
36-
private double yawError;
3733
private double strafeCorrection;
3834
private double targetYaw;
39-
private boolean isSandstorm;
4035
private boolean isGood = false;
4136
private RateLimit strafeRateLimit;
4237
private final ExpoScale driveExpo;
@@ -49,15 +44,14 @@ public VisionAutoAlignPlaceCommand() {
4944

5045
@Override
5146
protected void initialize() {
52-
gyroOffset =
47+
double gyroOffset =
5348
autoPlaceSideChooser.determineGyroOffset(
5449
VISION.direction, Math.IEEEremainder(DRIVE.getGyro().getAngle(), 360.0));
5550
targetYaw = autoPlaceSideChooser.determineTargetYaw(VISION.direction);
5651

5752
logger.debug("offset = {} target = {}", gyroOffset, targetYaw);
5853

5954
CONTROLS = Robot.CONTROLS;
60-
isSandstorm = DriverStation.getInstance().isAutonomous();
6155
DRIVE.setGyroOffset(gyroOffset);
6256
SmartDashboard.putBoolean("Game/haveHatch", true);
6357
logger.info("Begin Vision Auto Align Place");
@@ -78,7 +72,7 @@ protected void execute() {
7872
isGood = range >= 0; // check if range is good (we have a target), not -1
7973

8074
// Calculate Yaw Term based on gyro
81-
yawError = targetYaw - Math.IEEEremainder(DRIVE.getGyro().getAngle(), 360.0);
75+
double yawError = targetYaw - Math.IEEEremainder(DRIVE.getGyro().getAngle(), 360.0);
8276
DRIVE.setYawError(yawError);
8377
double yaw = kP_YAW * yawError;
8478
if (yaw > MAX_YAW) yaw = MAX_YAW;
@@ -88,7 +82,8 @@ protected void execute() {
8882
boolean onTarget = Math.abs(yawError) <= goodEnoughYaw;
8983

9084
double strafe;
91-
strafeError = Math.sin(Math.toRadians(VISION.getCorrectedBearing())) * range - strafeCorrection;
85+
double strafeError =
86+
Math.sin(Math.toRadians(VISION.getCorrectedBearing())) * range - strafeCorrection;
9287
VISION.setStrafeError(strafeError);
9388
forward = driveExpo.apply(CONTROLS.getDriverControls().getForward()) * FORWARD_SCALE;
9489

src/main/java/frc/team2767/deepspace/control/SmartDashboardControls.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ private void addMatchCommands() {
6666
SmartDashboard.putData("Game/Gyro", Robot.DRIVE.getGyro());
6767
SmartDashboard.putData("Game/Lvl2Deploy", new ClimbLevel2DeployCommand());
6868
SmartDashboard.putData("Game/Lvl2Climb", new ClimbLevel2AutoCommand());
69+
SmartDashboard.putData("Stop pump", new StopPumpCommandGroup());
6970
}
7071

7172
private void addClimbTab() {

src/main/java/frc/team2767/deepspace/subsystem/ElevatorSubsystem.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ public int getTicks() {
257257
@SuppressWarnings("Duplicates")
258258
@Override
259259
public void setLimits(int forward, int reverse) {
260+
if (elevator.hasResetOccurred()) {
261+
logger.warn("ELEVATOR TALON RESET");
262+
}
263+
260264
if (forward != currentForwardLimit) {
261265
elevator.configForwardSoftLimitThreshold(forward, 0);
262266
currentForwardLimit = forward;

src/main/java/frc/team2767/deepspace/subsystem/VisionSubsystem.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class VisionSubsystem extends Subsystem implements Item {
3030
private static final double CAMERA_Y_LEFT = -13.5;
3131
private static final double CAMERA_Y_RIGHT = 13.5;
3232
private static final double GLUE_CORRECTION_FACTOR_RIGHT = -2.21; // -2.26 comp
33-
private static final double GLUE_CORRECTION_FACTOR_LEFT = 0.21; // 0.6147 comp
33+
private static final double GLUE_CORRECTION_FACTOR_LEFT = 0.6417; // 0.6147 comp
3434
private static final double CAMERA_DEGREES_PER_PIXEL_ADJUSTMENT_RIGHT =
3535
1.0; // 1.0 is zero value 0.85
3636
private static final double CAMERA_DEGREES_PER_PIXEL_ADJUSTMENT_LEFT =
@@ -43,8 +43,8 @@ public class VisionSubsystem extends Subsystem implements Item {
4343
private static final double CAMERA_RANGE_OFFSET_LEFT = -4.92; // -5.6325
4444
// NEGATIVE = TOWARDS FIELD LEFT (this one was negative)
4545
private static final double STRAFE_CORRECTION_RIGHT =
46-
0.0; // -1.0 // NEGATIVE TO FIELD LEFT FOR THIS ONE?
47-
private static final double STRAFE_CORRECTION_LEFT = 1.0; // was positive
46+
-0.5; // -1.0 // NEGATIVE TO FIELD LEFT FOR THIS ONE?
47+
private static final double STRAFE_CORRECTION_LEFT = 0.5; // was positive
4848

4949
private final Logger logger = LoggerFactory.getLogger(this.getClass());
5050
private final DigitalOutput lightsOutput6 = new DigitalOutput(6);

src/main/java/frc/team2767/deepspace/subsystem/safety/IntakePosition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package frc.team2767.deepspace.subsystem.safety;
22

33
enum IntakePosition {
4-
INTAKE_INTAKE(12_081, -700),
4+
INTAKE_INTAKE(12_081, -800),
55
INTAKE_STOW(12_081, -475);
66

77
public final int forwardLimit;

0 commit comments

Comments
 (0)