Skip to content

Commit 88087df

Browse files
Quals day!
1 parent a16a1c4 commit 88087df

File tree

12 files changed

+75
-43
lines changed

12 files changed

+75
-43
lines changed

simgui-ds.json

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"System Joysticks": {
2+
"Keyboard 1 Settings": {
33
"window": {
4-
"visible": false
4+
"visible": true
55
}
66
},
77
"keyboardJoysticks": [
@@ -47,23 +47,34 @@
4747
{
4848
"axisConfig": [
4949
{
50-
"decKey": 74,
51-
"incKey": 76
50+
"decKey": 74
5251
},
5352
{
54-
"decKey": 73,
55-
"incKey": 75
53+
"decKey": 73
5654
}
5755
],
58-
"axisCount": 2,
59-
"buttonCount": 4,
56+
"axisCount": 0,
57+
"buttonCount": 8,
6058
"buttonKeys": [
6159
77,
6260
44,
6361
46,
64-
47
62+
47,
63+
75,
64+
76,
65+
59,
66+
39,
67+
79,
68+
-1,
69+
91,
70+
93
6571
],
66-
"povCount": 0
72+
"povConfig": [
73+
{
74+
"key90": 80
75+
}
76+
],
77+
"povCount": 1
6778
},
6879
{
6980
"axisConfig": [
@@ -95,10 +106,11 @@
95106
}
96107
],
97108
"robotJoysticks": [
98-
{},
99109
{
100-
"guid": "78696e70757401000000000000000000",
101-
"useGamepad": true
110+
"guid": "Keyboard0"
111+
},
112+
{
113+
"guid": "Keyboard1"
102114
},
103115
{},
104116
{},

src/main/deploy/pathplanner/autos/C5HopC1.1.auto

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
{
22
"version": 1.0,
3-
"startingPose": {
4-
"position": {
5-
"x": 8.2,
6-
"y": 0.74
7-
},
8-
"rotation": 0
9-
},
3+
"startingPose": null,
104
"command": {
115
"type": "sequential",
126
"data": {

src/main/deploy/pathplanner/autos/C5HopC1.2.auto

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
{
22
"version": 1.0,
3-
"startingPose": {
4-
"position": {
5-
"x": 8.2,
6-
"y": 2.43
7-
},
8-
"rotation": 0
9-
},
3+
"startingPose": null,
104
"command": {
115
"type": "sequential",
126
"data": {

src/main/deploy/pathplanner/paths/C5HopC1.1.path

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
},
99
"prevControl": null,
1010
"nextControl": {
11-
"x": 6.51600289023277,
12-
"y": 2.596271462111395
11+
"x": 7.194394331808605,
12+
"y": 0.7718141932010376
1313
},
1414
"isLocked": false,
1515
"linkedName": null

src/main/java/frc/robot/Constants.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,16 @@ public static List<Pose2d> getChainPositions() {
181181
}
182182
}
183183

184+
public static boolean enableVisionSnapping(Pose2d currentPosition) {
185+
Measure<Distance> currentX = Units.Meters.of(currentPosition.getX());
186+
187+
if (isRedAlliance()) {
188+
return currentX.gte(redConstants.WING_LINE_X);
189+
} else {
190+
return currentX.lte(blueConstants.WING_LINE_X);
191+
}
192+
}
193+
184194
private static final class blueConstants {
185195
/**
186196
* The coordinate of the center of the blue speaker, in meters
@@ -208,6 +218,8 @@ private static final class blueConstants {
208218

209219
private static final Pose3d SHUFFLE = new Pose3d(
210220
new Pose2d(3.42, 6.08, Rotation2d.fromDegrees(0)));
221+
222+
private static final Measure<Distance> WING_LINE_X = Units.Meters.of(6.3);
211223
}
212224

213225
private static final class redConstants {
@@ -235,6 +247,8 @@ private static final class redConstants {
235247
new Pose2d(FIELD_LENGTH.in(Units.Meters) - 1.35, 5.50, Rotation2d.fromDegrees(180)));
236248
private static final Pose3d SHUFFLE = new Pose3d(
237249
new Pose2d(FIELD_LENGTH.in(Units.Meters) - 3.42, 6.08, Rotation2d.fromDegrees(0)));
250+
251+
private static final Measure<Distance> WING_LINE_X = FIELD_LENGTH.minus(Units.Meters.of(6.3));
238252
}
239253
}
240254

@@ -382,7 +396,7 @@ public ShooterPositionGroup(Measure<Angle> shooterAngle, Measure<Velocity<Angle>
382396
}
383397

384398
public static final ShooterPositionGroup PREP_NONE = new ShooterPositionGroup(NONE_STATE_ANGLE,
385-
Units.RotationsPerSecond.of(10), Units.RotationsPerSecond.of(10), Units.Meters.of(0));
399+
Units.RotationsPerSecond.of(0), Units.RotationsPerSecond.of(0), Units.Meters.of(0));
386400
public static final ShooterPositionGroup PREP_AMP_SHOOTER = new ShooterPositionGroup(Units.Degrees.of(111),
387401
Units.RotationsPerSecond.of(10), Units.RotationsPerSecond.of(10), Units.Meters.of(0));
388402
// Amping w/ amper
@@ -598,7 +612,7 @@ public static class constIntake {
598612
// -- Current Limiting --
599613
public static final boolean ENABLE_CURRENT_LIMITING = true;
600614
public static final double CURRENT_LIMIT = 30;
601-
public static final double CURRENT_THRESH = 40;
615+
public static final double CURRENT_THRESH = 35;
602616
public static final double CURRENT_TIME_THRESH = 0.1;
603617
}
604618

src/main/java/frc/robot/RobotContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public RobotContainer() {
101101
new Drive(subDrivetrain, subStateMachine, conDriver.axis_LeftY, conDriver.axis_LeftX, conDriver.axis_RightX,
102102
conDriver.btn_LeftBumper, conDriver.btn_RightBumper, conDriver.btn_RightTrigger,
103103
conDriver.btn_Y, conDriver.btn_B, conDriver.btn_A,
104-
new Trigger(() -> conDriver.btn_X.getAsBoolean() || conDriver.btn_LeftTrigger.getAsBoolean())));
104+
conDriver.btn_X, conDriver.btn_LeftTrigger));
105105

106106
// - Manual Triggers -
107107
gamePieceStoredTrigger

src/main/java/frc/robot/RobotPreferences.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static final class prefDrivetrain {
5353
public static final SN_DoublePreference driveI = new SN_DoublePreference("driveI", 0.0);
5454
public static final SN_DoublePreference driveD = new SN_DoublePreference("driveD", 0);
5555

56-
public static final SN_DoublePreference steerP = new SN_DoublePreference("steerP", 100);
56+
public static final SN_DoublePreference steerP = new SN_DoublePreference("steerP", 100); // 80
5757
public static final SN_DoublePreference steerI = new SN_DoublePreference("steerI", 0.0);
5858
public static final SN_DoublePreference steerD = new SN_DoublePreference("steerD", 0.14414076246334312);
5959

src/main/java/frc/robot/commands/Autos/WingOnly.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,13 @@ public WingOnly(StateMachine subStateMachine, Climber subClimber, Drivetrain sub
7070
// -- PRELOAD --
7171
Commands.runOnce(() -> subStateMachine.setTargetState(TargetState.PREP_VISION)),
7272

73-
Commands.deferredProxy(() -> subStateMachine.tryState(RobotState.INTAKING, subStateMachine, subClimber,
74-
subDrivetrain, subElevator, subIntake, subLEDs, subTransfer, subShooter))
75-
.until(() -> subTransfer.getGamePieceStored()).withTimeout(1),
73+
// Commands.deferredProxy(() -> subStateMachine.tryState(RobotState.INTAKING,
74+
// subStateMachine, subClimber,
75+
// subDrivetrain, subElevator, subIntake, subLEDs, subTransfer, subShooter))
76+
// .until(() -> subTransfer.getGamePieceStored()).withTimeout(1),
77+
Commands.runOnce(() -> subStateMachine.setRobotState(RobotState.INTAKING)),
78+
Commands.runOnce(() -> subTransfer.setGamePieceCollected(true)),
79+
7680
Commands.deferredProxy(shootSequence),
7781
Commands.runOnce(() -> subStateMachine.setTargetState(TargetState.PREP_VISION)),
7882

src/main/java/frc/robot/commands/Drive.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ public class Drive extends Command {
2424
StateMachine subStateMachine;
2525
DoubleSupplier xAxis, yAxis, rotationAxis;
2626
boolean isOpenLoop;
27-
Trigger slowMode, north, south, east, west, chain, source;
27+
Trigger slowMode, north, south, east, west, chain, source, amp;
2828
Measure<Angle> northYaw, sourceYaw;
2929
double redAllianceMultiplier = 1;
3030
double slowMultiplier = 0;
3131

3232
public Drive(Drivetrain subDrivetrain, StateMachine subStateMachine, DoubleSupplier xAxis, DoubleSupplier yAxis,
3333
DoubleSupplier rotationAxis, Trigger slowMode, Trigger chain, Trigger source, Trigger north, Trigger east,
34-
Trigger south,
35-
Trigger west) {
34+
Trigger south, Trigger west, Trigger amp) {
3635
this.subDrivetrain = subDrivetrain;
3736
this.subStateMachine = subStateMachine;
3837
this.xAxis = xAxis;
@@ -45,6 +44,7 @@ public Drive(Drivetrain subDrivetrain, StateMachine subStateMachine, DoubleSuppl
4544
this.south = south;
4645
this.west = west;
4746
this.chain = chain;
47+
this.amp = amp;
4848

4949
isOpenLoop = true;
5050

@@ -90,6 +90,12 @@ public void execute() {
9090
rVelocity = subDrivetrain.getVelocityToChain();
9191
} else if (source.getAsBoolean()) {
9292
rVelocity = subDrivetrain.getVelocityToSnap(sourceYaw);
93+
} else if (amp.getAsBoolean()) {
94+
if (constField.isRedAlliance()) {
95+
rVelocity = subDrivetrain.getVelocityToSnap(northYaw.plus(Units.Degrees.of(270)));
96+
} else {
97+
rVelocity = subDrivetrain.getVelocityToSnap(northYaw.plus(Units.Degrees.of(90)));
98+
}
9399
}
94100

95101
// Ignore calculated rotation if a driver rotation is given
@@ -102,7 +108,9 @@ public void execute() {
102108
// rVelocity = subDrivetrain.getVelocityToSnap(Units.Degrees.of(90));
103109
// break;
104110
case PREP_VISION:
105-
rVelocity = subDrivetrain.getVelocityToSnap(subDrivetrain.getAngleToSpeaker());
111+
if (constField.enableVisionSnapping(subDrivetrain.getPose())) {
112+
rVelocity = subDrivetrain.getVelocityToSnap(subDrivetrain.getAngleToSpeaker());
113+
}
106114
break;
107115
default:
108116
break;

src/main/java/frc/robot/commands/States/NoneState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void initialize() {
6060
subLEDs.clearAnimation();
6161
subLEDs.setLEDs(constLEDs.CLEAR_LEDS);
6262
subShooter.setDesiredVelocities(desiredShooterPosition.leftVelocity, desiredShooterPosition.rightVelocity);
63-
subShooter.getUpToSpeed();
63+
subShooter.setShootingNeutralOutput();
6464

6565
if (subShooter.isSafeToMoveElevator()) {
6666
subShooter.setPivotNeutralOutput();

0 commit comments

Comments
 (0)