Skip to content

Commit 424a9cc

Browse files
authored
Merge pull request #185 from TheGreenMachine/3-30-changes
3 30 changes
2 parents c4e4829 + e6efacc commit 424a9cc

7 files changed

Lines changed: 21 additions & 91 deletions

File tree

src/main/java/com/team1816/lib/BaseRobotState.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class BaseRobotState {
2929
* its pose. Other cases might be if we leave the ground while climbing, or if we had to use a
3030
* default auto without the correct starting pose.
3131
*/
32-
public static volatile boolean hasAccuratePoseEstimate = true;
32+
public static boolean hasAccuratePoseEstimate = true;
3333

3434
/**
3535
* If you are trying to get the pose of the robot on the field, you probably want to use the
@@ -42,5 +42,5 @@ public class BaseRobotState {
4242
* as the source of truth during simulation, while the raw odometry position is just supposed
4343
* to be the pre-vision position estimate of the real robot.
4444
*/
45-
public static volatile Pose2d simActualOrRawOdometryPose = Pose2d.kZero;
45+
public static Pose2d simActualOrRawOdometryPose = Pose2d.kZero;
4646
}

src/main/java/com/team1816/lib/subsystems/BaseSuperstructure.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void periodic() {
5151
* and both methods access {@code goodVisionEstimatesSincePoseLoss} and
5252
* {@link BaseRobotState#hasAccuratePoseEstimate}.
5353
*/
54-
private synchronized void handlePoseLossFromTilting() {
54+
private void handlePoseLossFromTilting() {
5555
// The threshold of how far the robot can be tilted before we decide we don't have an
5656
// accurate pose estimate. Mainly to account for gyro noise.
5757
final double tiltPoseLossThresholdRadians = Units.degreesToRadians(5.0);
@@ -75,7 +75,7 @@ private synchronized void handlePoseLossFromTilting() {
7575
* ({@code goodVisionEstimatesSincePoseLoss}, {@code visionEstimateSincePoseLossVarianceSum},
7676
* and {@link BaseRobotState#hasAccuratePoseEstimate}).
7777
*/
78-
public synchronized void addVisionMeasurementsToDrivetrain() {
78+
public void addVisionMeasurementsToDrivetrain() {
7979
List<Pair<EstimatedRobotPose, Matrix<N3, N1>>> visionMeasurements = vision
8080
.getVisionEstimatedPosesWithStdDevs();
8181

src/main/java/com/team1816/season/subsystems/Gatekeeper.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public class Gatekeeper extends SubsystemBase implements ITestableSubsystem {
1616

1717
//MOTORS
1818
private final IMotor topMotor = (IMotor)factory.getDevice(NAME, "topMotor");
19-
private final IMotor bottomMotor = (IMotor)factory.getDevice(NAME, "bottomMotor");
2019

2120
private final VelocityVoltage voltageReq = new VelocityVoltage(0);
2221

@@ -33,17 +32,12 @@ public void periodic() {
3332

3433
private void applyState() {
3534
setTopVelocity(wantedState.getTopMotorValue());
36-
setBottomVelocity(wantedState.getBottomMotorValue());
3735
}
3836

3937
private void setTopVelocity(double velocity) {
4038
topMotor.setControl(voltageReq.withVelocity(velocity));
4139
}
4240

43-
private void setBottomVelocity(double velocity) {
44-
bottomMotor.setControl(voltageReq.withVelocity(velocity));
45-
}
46-
4741
public void setWantedState(GatekeeperState state) {
4842
wantedState = state;
4943
}
@@ -58,9 +52,9 @@ public GatekeeperState getState() {
5852
}
5953

6054
public enum GatekeeperState {
61-
OPEN(factory.getConstant(NAME, "topOpenVelocity", 0), factory.getConstant(NAME, "bottomOpenVelocity", 0)),
62-
CLOSED(factory.getConstant(NAME, "topClosedVelocity", 0), factory.getConstant(NAME, "bottomClosedVelocity", 0)),
63-
REVERSING(factory.getConstant(NAME, "topReversingVelocity", 0), factory.getConstant(NAME, "bottomReversingVelocity", 0));
55+
OPEN(factory.getConstant(NAME, "topOpenVelocity", 0), 0),
56+
CLOSED(factory.getConstant(NAME, "topClosedVelocity", 0), 0),
57+
REVERSING(factory.getConstant(NAME, "topReversingVelocity", 0), 0);
6458

6559
private double topMotorValue, bottomMotorValue;
6660

@@ -72,9 +66,5 @@ public enum GatekeeperState {
7266
public double getTopMotorValue() {
7367
return topMotorValue;
7468
}
75-
76-
public double getBottomMotorValue() {
77-
return bottomMotorValue;
78-
}
7969
}
8070
}

src/main/java/com/team1816/season/subsystems/Intake.java

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ public class Intake extends SubsystemBase implements ITestableSubsystem {
3535
* lower current to just hold it out instead of pushing it out.
3636
*/
3737
private final double FLIPPER_MOTOR_OUT_POSITION;
38-
private final double FLIPPER_MOTOR_PULL_IN_ONE_POSITION;
39-
private final double FLIPPER_MOTOR_PULL_IN_TWO_POSITION;
4038
private final double FLIPPER_MOTOR_IN_POSITION;
4139
private final double FLIPPER_MOTOR_RETRACT_CURRENT_AMPERES;
4240
private final double FLIPPER_MOTOR_EXTEND_CURRENT_AMPERES;
@@ -55,8 +53,6 @@ public Intake () {
5553
super();
5654
SmartDashboard.putData("Intake", intakeMech);
5755
FLIPPER_MOTOR_OUT_POSITION = factory.getConstant(NAME, "flipperMotorOutPosition", 0);
58-
FLIPPER_MOTOR_PULL_IN_ONE_POSITION = factory.getConstant(NAME, "flipperMotorPullInOnePosition", 0);
59-
FLIPPER_MOTOR_PULL_IN_TWO_POSITION = factory.getConstant(NAME, "flipperMotorPullInTwoPosition", 0);
6056
FLIPPER_MOTOR_IN_POSITION = factory.getConstant(NAME, "flipperMotorInPosition", 0);
6157
FLIPPER_MOTOR_RETRACT_CURRENT_AMPERES = factory.getConstant(NAME, "flipperMotorRetractCurrentAmperes", 0);
6258
FLIPPER_MOTOR_EXTEND_CURRENT_AMPERES = factory.getConstant(NAME, "flipperMotorExtendCurrentAmperes", 0);
@@ -119,30 +115,6 @@ private void setFlipperPosition(FlipperPosition position) {
119115
);
120116
}
121117
}
122-
case PULL_IN_ONE -> {
123-
if (flipperMotor.getMotorPosition() > FLIPPER_MOTOR_PULL_IN_ONE_POSITION) {
124-
flipperMotor.setControl(
125-
flipperMotorTorqueCurrentRequest.withOutput(FLIPPER_MOTOR_RETRACT_CURRENT_AMPERES)
126-
);
127-
}
128-
else {
129-
flipperMotor.setControl(
130-
flipperMotorTorqueCurrentRequest.withOutput(0)
131-
);
132-
}
133-
}
134-
case PULL_IN_TWO -> {
135-
if (flipperMotor.getMotorPosition() > FLIPPER_MOTOR_PULL_IN_TWO_POSITION) {
136-
flipperMotor.setControl(
137-
flipperMotorTorqueCurrentRequest.withOutput(FLIPPER_MOTOR_RETRACT_CURRENT_AMPERES)
138-
);
139-
}
140-
else {
141-
flipperMotor.setControl(
142-
flipperMotorTorqueCurrentRequest.withOutput(0)
143-
);
144-
}
145-
}
146118
}
147119
}
148120

@@ -156,14 +128,12 @@ public void setWantedState(IntakeState state) {
156128
*/
157129
public enum FlipperPosition {
158130
IN,
159-
OUT,
160-
PULL_IN_ONE,
161-
PULL_IN_TWO
131+
OUT
162132
}
163133

164134
public enum IntakeState {
165135
STOW(
166-
factory.getConstant(NAME, "intakeOffSpeed", 0, true),
136+
factory.getConstant(NAME, "intakeSlowSpeed", .1, true),
167137
FlipperPosition.IN
168138
),
169139
INTAKE(
@@ -177,14 +147,6 @@ public enum IntakeState {
177147
STOP_OUT(
178148
0,
179149
FlipperPosition.OUT
180-
),
181-
PULL_IN_ONE(
182-
factory.getConstant(NAME, "intakeOnSpeed", 0),
183-
FlipperPosition.PULL_IN_ONE
184-
),
185-
PULL_IN_TWO(
186-
factory.getConstant(NAME, "intakeOnSpeed", 0),
187-
FlipperPosition.PULL_IN_TWO
188150
);
189151

190152
private double intakeMotorValue;

src/main/java/com/team1816/season/subsystems/Shooter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -636,11 +636,11 @@ private boolean areLaunchMotorsAimed() {
636636
private void setInclineAngle(double wantedAngleDegrees) {
637637
wantedInclineAngleDegrees = wantedAngleDegrees + inclineAngleAdjustmentDegrees;
638638
double rotations = Units.degreesToRotations(wantedInclineAngleDegrees);
639-
// if (isInclineDucking) {
640-
// // If we are trying to duck under the trench, restrict the angle of the incline to be
641-
// // below the limit.
642-
// rotations = Math.min(rotations, INCLINE_DUCKING_LIMIT_ROTATIONS);
643-
// }
639+
if (isInclineDucking) {
640+
// If we are trying to duck under the trench, restrict the angle of the incline to be
641+
// below the limit.
642+
rotations = Math.min(rotations, INCLINE_DUCKING_LIMIT_ROTATIONS);
643+
}
644644
inclineMotor.setControl(inclineMotorPositionRequest.withPosition(rotations));
645645
}
646646

src/main/java/com/team1816/season/subsystems/Superstructure.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,6 @@ public void setSuperstructureWantedIntakeState(WantedIntakeState intakeState) {
9292
this.wantedIntakeState = intakeState;
9393
}
9494

95-
public void incrementPullInSuperstructureIntakeState() {
96-
wantedIntakeState = switch (wantedIntakeState) {
97-
case INTAKE, OUTTAKE, STOP_OUT -> WantedIntakeState.PULL_IN_ONE;
98-
case PULL_IN_ONE -> WantedIntakeState.PULL_IN_TWO;
99-
case PULL_IN_TWO, STOW -> WantedIntakeState.STOW;
100-
};
101-
}
102-
10395
/**
10496
* Sets if the incline of the shooter should duck down to fit under the trench.
10597
*
@@ -252,8 +244,6 @@ private void defaulting() {
252244
case OUTTAKE -> Intake.IntakeState.OUTTAKE;
253245
case STOP_OUT -> Intake.IntakeState.STOP_OUT;
254246
case STOW -> Intake.IntakeState.STOW;
255-
case PULL_IN_ONE -> Intake.IntakeState.PULL_IN_ONE;
256-
case PULL_IN_TWO -> Intake.IntakeState.PULL_IN_TWO;
257247
}
258248
);
259249
feeder.setWantedState(
@@ -310,7 +300,5 @@ public enum WantedIntakeState {
310300
STOW,
311301
OUTTAKE,
312302
STOP_OUT,
313-
PULL_IN_ONE,
314-
PULL_IN_TWO
315303
}
316304
}

src/main/resources/yaml/ztldr.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ subsystems:
169169
neutralMode: Coast
170170
motorRotation: CounterClockwise_Positive
171171
constants:
172-
feedingDutyCycle: 0.8
172+
feedingDutyCycle: 0.7
173173
stoppedDutyCycle: 0
174174
reversingDutyCycle: -0.4
175175
intake:
@@ -183,6 +183,8 @@ subsystems:
183183
flipperMotor:
184184
id: 3
185185
deviceType: TalonFX
186+
supplyCurrentLimit: 35
187+
statorCurrentLimit: 60
186188
neutralMode: Brake
187189
motorRotation: Clockwise_Positive
188190
remoteSensor: RemoteCANcoder # ExternalFeedbackSensorSourceValue
@@ -194,7 +196,7 @@ subsystems:
194196
deviceType: CANcoder
195197
constants:
196198
intakeOnSpeed: .4
197-
intakeOffSpeed: 0
199+
intakeSlowSpeed: .1
198200
outtakeSpeed: -0.6
199201
flipperMotorOutPosition: 0.166
200202
flipperMotorPullInOnePosition: 0.1
@@ -216,22 +218,10 @@ subsystems:
216218
kP: 0.5
217219
kS: 0.31
218220
kV: 0.081
219-
bottomMotor:
220-
deviceType: TalonFX
221-
id: 24
222-
motorRotation: Clockwise_Positive
223-
pidConfig:
224-
slot0:
225-
kP: 0.5
226-
kS: 0.31
227-
kV: 0.08
228221
constants:
229222
topClosedVelocity: 0
230223
topOpenVelocity: 40
231224
topReversingVelocity: -10
232-
bottomClosedVelocity: 0
233-
bottomOpenVelocity: 40
234-
bottomReversingVelocity: -10
235225
shooter:
236226
canBusName: shootercanivore
237227
devices:
@@ -295,11 +285,11 @@ subsystems:
295285
leftTurretSensorChannel: 0
296286
rightTurretSensorChannel: 1
297287
motorRotationsPerTurretRotation: 15.625 # 250/16 gear ratio
298-
shooterOffsetXMeters: -0.11303
288+
shooterOffsetXMeters: -0.111303
299289
shooterOffsetYMeters: -0.112268
300290
shooterOffsetZMeters: 0.508
301-
inclineDuckingLimitRotations: 0.058
302-
distanceOneInclineAngleRotations: 0.058
291+
inclineDuckingLimitRotations: 0.064
292+
distanceOneInclineAngleRotations: 0.064
303293
distanceOneLaunchVelocityRPS: 35
304294
distanceTwoInclineAngleRotations: 0.08
305295
distanceTwoLaunchVelocityRPS: 47

0 commit comments

Comments
 (0)