Skip to content

Commit 9cd9f1a

Browse files
committed
Merge remote-tracking branch 'origin/work_april_3'
2 parents f28612b + e6cbdb6 commit 9cd9f1a

10 files changed

Lines changed: 70 additions & 62 deletions

File tree

src/main/deploy/pathplanner/paths/a7CollectLoop.path

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,47 +33,47 @@
3333
{
3434
"anchor": {
3535
"x": 6.708995782632744,
36-
"y": 2.9864684043141585
36+
"y": 3.7499931899889374
3737
},
3838
"prevControl": {
3939
"x": 7.697838255014892,
40-
"y": 2.580282702370341
40+
"y": 3.34380748804512
4141
},
4242
"nextControl": {
4343
"x": 5.825374028251257,
44-
"y": 3.349432711148226
44+
"y": 4.112957496823005
4545
},
4646
"isLocked": false,
4747
"linkedName": null
4848
},
4949
{
5050
"anchor": {
51-
"x": 6.129280835176992,
52-
"y": 4.461494607300884
51+
"x": 6.008044558904868,
52+
"y": 4.801829300331858
5353
},
5454
"prevControl": {
55-
"x": 6.156139549466578,
56-
"y": 4.0372859451716305
55+
"x": 6.034903273194454,
56+
"y": 4.377620638202604
5757
},
5858
"nextControl": {
59-
"x": 6.1024221208874065,
60-
"y": 4.885703269430138
59+
"x": 5.981185844615283,
60+
"y": 5.2260379624611115
6161
},
6262
"isLocked": false,
6363
"linkedName": null
6464
},
6565
{
6666
"anchor": {
67-
"x": 4.654466848727876,
68-
"y": 5.592790652654867
67+
"x": 4.634185011061947,
68+
"y": 5.56311065403761
6969
},
7070
"prevControl": {
71-
"x": 5.071713567647901,
72-
"y": 5.52944676656619
71+
"x": 5.051431729981973,
72+
"y": 5.499766767948933
7373
},
7474
"nextControl": {
75-
"x": 4.067828395426444,
76-
"y": 5.681850572544342
75+
"x": 4.047546557760516,
76+
"y": 5.652170573927084
7777
},
7878
"isLocked": false,
7979
"linkedName": null
@@ -102,8 +102,12 @@
102102
"rotationDegrees": -56.98406371610071
103103
},
104104
{
105-
"waypointRelativePos": 1.7967115097160609,
106-
"rotationDegrees": 165.52779753636696
105+
"waypointRelativePos": 1.375409915123457,
106+
"rotationDegrees": -78.72123223305731
107+
},
108+
{
109+
"waypointRelativePos": 1.9728009259259265,
110+
"rotationDegrees": -177.36077850349736
107111
},
108112
{
109113
"waypointRelativePos": 3.0,
@@ -136,6 +140,19 @@
136140
"nominalVoltage": 12.0,
137141
"unlimited": false
138142
}
143+
},
144+
{
145+
"name": "Constraints Zone",
146+
"minWaypointRelativePos": 0.8977962551299594,
147+
"maxWaypointRelativePos": 3.0263284456224335,
148+
"constraints": {
149+
"maxVelocity": 2.5,
150+
"maxAcceleration": 3.0,
151+
"maxAngularVelocity": 540.0,
152+
"maxAngularAcceleration": 300.0,
153+
"nominalVoltage": 12.0,
154+
"unlimited": false
155+
}
139156
}
140157
],
141158
"pointTowardsZones": [],

src/main/deploy/pathplanner/paths/a7DepotCollectFast.path

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
"minWaypointRelativePos": 0,
5757
"maxWaypointRelativePos": 0.800786593707251,
5858
"constraints": {
59-
"maxVelocity": 0.8,
60-
"maxAcceleration": 1.5,
59+
"maxVelocity": 2.0,
60+
"maxAcceleration": 2.0,
6161
"maxAngularVelocity": 540.0,
6262
"maxAngularAcceleration": 720.0,
6363
"nominalVoltage": 12.0,

src/main/deploy/pathplanner/paths/a7StartToCollect.path

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"pointTowardsZones": [],
3434
"eventMarkers": [],
3535
"globalConstraints": {
36-
"maxVelocity": 2.0,
37-
"maxAcceleration": 1.5,
36+
"maxVelocity": 3.0,
37+
"maxAcceleration": 3.0,
3838
"maxAngularVelocity": 540.0,
3939
"maxAngularAcceleration": 720.0,
4040
"nominalVoltage": 12.0,

src/main/deploy/tuning/arc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
},
114114
{
115115
"distance": 5.3,
116-
"velocity": 68.5
116+
"velocity": 70.0
117117
}
118118
]
119119
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ private void configureBindings() {
303303
gamepad_.rightTrigger().or(operatorGamepad_.rightTrigger())
304304
.whileTrue(RobotCommands.shoot(shooter_, hopper_, intake_, drivebase_));
305305

306+
gamepad_.rightBumper()
307+
.whileTrue(intake_.hopperEjectSequence().alongWith(hopper_.reverseFeed()));
308+
306309
// When the shooter isnt shooting, get it ready to shoot.
307310
shooter_.setDefaultCommand(shooter_.spinUpVelocityCommand(() -> {
308311
return RotationsPerSecond.zero();

src/main/java/frc/robot/RobotState.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ public static void periodic() {
7070
inAllianceZone = currentPose.getMeasureX().minus(allianceWall).abs(Meters) < ShooterConstants.Positions.spinUpZone.in(Meters);
7171

7272
// Other logging
73-
Logger.recordOutput("ShiftInfo", HubShiftUtil.getOfficialShiftInfo());
73+
var shift = HubShiftUtil.getOfficialShiftInfo();
74+
Logger.recordOutput("ShiftInfo", shift);
75+
Logger.recordOutput("Shift/Active", shift.active());
76+
Logger.recordOutput("Shift/Name", shift.currentShift());
77+
Logger.recordOutput("Shift/SecondsRemaining", shift.remainingTime());
7478

7579
LoggedTracer.record("RobotState");
7680
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public static Command a7CoopDepot(Drive drive, Shooter shooter, IntakeSubsystem
167167
.andThen(shooter.spinUpForDistanceHoodParked(() -> Meters.of(2)))
168168
),
169169

170-
RobotCommands.shoot(shooter, hopper, intake, drive).withTimeout(Seconds.of(5)),
170+
RobotCommands.shoot(shooter, hopper, intake, drive).withTimeout(Seconds.of(4.5)),
171171

172172
DriveCommands.followPathCommand("a7CollectLoop").deadlineFor(
173173
RobotCommands.intake(intake, hopper)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ public static Command shootHubNoAim(Shooter shooter, Hopper hopper, IntakeSubsys
7070
() -> !drive.rotationIsNear(RobotState.rotationToHub(), ShooterConstants.defenseTolerance);
7171

7272
return Commands.repeatingSequence(
73-
Commands.waitUntil(shouldShoot).deadlineFor(shooter.spinUpForDistance(RobotState::hubDistance)),
74-
shooter.shootAtDistance(RobotState::hubDistance, hopper, intake)
73+
Commands.waitUntil(shouldShoot),
74+
hopper.feedForShooting(shouldShoot, intake)
7575
.until(shouldStopShooting)
76-
);
76+
).alongWith(shooter.shootAtDistance(RobotState::hubDistance));
7777
}
7878

7979
/**
@@ -109,7 +109,7 @@ public static Command ferry(Shooter shooter, Hopper hopper, IntakeSubsystem inta
109109

110110
return DriveCommands.joystickDriveAtAngle(targetingAngle)
111111
.alongWith(
112-
shooter.shootAtDistance(targetDistance, hopper, intake),
112+
shooter.shootAtDistance(targetDistance),
113113
Commands.runOnce(() -> {
114114
Logger.recordOutput("Ferry/Target", target.get());
115115
Logger.recordOutput("Ferry/IsFerrying", true);

src/main/java/frc/robot/subsystems/hopper/Hopper.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import static edu.wpi.first.units.Units.RotationsPerSecond;
77
import static edu.wpi.first.units.Units.Volts;
88

9+
import java.util.function.BooleanSupplier;
910
import java.util.function.Supplier;
1011

1112
import org.littletonrobotics.junction.AutoLogOutput;
@@ -16,9 +17,11 @@
1617
import edu.wpi.first.wpilibj.Alert;
1718
import edu.wpi.first.wpilibj.Alert.AlertType;
1819
import edu.wpi.first.wpilibj2.command.Command;
20+
import edu.wpi.first.wpilibj2.command.Commands;
1921
import edu.wpi.first.wpilibj2.command.SubsystemBase;
2022
import frc.robot.Constants;
2123
import frc.robot.Constants.Mode;
24+
import frc.robot.subsystems.intake.IntakeSubsystem;
2225
import frc.robot.util.LoggedTracer;
2326
import frc.robot.util.MapleSimUtil;
2427

@@ -110,6 +113,19 @@ private void stopAll() {
110113

111114
// Commands
112115

116+
public Command feedForShooting(BooleanSupplier shouldFeed, IntakeSubsystem intake) {
117+
return Commands.parallel(
118+
preShoot().until(shouldFeed)
119+
.andThen(forwardFeed()),
120+
121+
Commands.run(() -> {
122+
Logger.recordOutput("Command/ReadyForShoot", shouldFeed);
123+
}),
124+
125+
intake.shakeBalls()
126+
);
127+
}
128+
113129
/**
114130
* Runs the scrambler at its idling speed until the command ends.
115131
* @return

src/main/java/frc/robot/subsystems/shooter/Shooter.java

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import frc.robot.Constants.Mode;
3939
import frc.robot.RobotState;
4040
import frc.robot.subsystems.hopper.Hopper;
41-
import frc.robot.subsystems.intake.IntakeSubsystem;
4241
import frc.robot.subsystems.shooter.ShooterTuning.ShooterParams;
4342
import frc.robot.util.LoggedTracer;
4443
import frc.robot.util.MapleSimUtil;
@@ -245,7 +244,7 @@ public Command hoodToPosCmd(Angle pos) {
245244
*
246245
*
247246
*/
248-
public Command shootAtDistance(Supplier<Distance> distance, Hopper hopper, IntakeSubsystem intake) {
247+
public Command shootAtDistance(Supplier<Distance> distance) {
249248
Supplier<ShooterParams> shooterParams =
250249
() -> getTuning().getShooterParams(distance.get().in(Meters));
251250

@@ -254,41 +253,10 @@ public Command shootAtDistance(Supplier<Distance> distance, Hopper hopper, Intak
254253
runDynamicSetpoints(
255254
() -> RotationsPerSecond.of(shooterParams.get().velocity),
256255
() -> Degrees.of(shooterParams.get().hood)
257-
),
258-
259-
hopper.preShoot().until(this::isShooterReady).andThen(
260-
hopper.forwardFeed().deadlineFor(Commands.run(() -> {
261-
var diff = shooterTarget.minus(shooterInputs.wheelVelocity).abs(RadiansPerSecond);
262-
// Ball counting?
263-
if (diff > 15.0) {
264-
if (!isCounted) {
265-
addBallToCount();
266-
}
267-
isCounted = true;
268-
} else {
269-
isCounted = false;
270-
}
271-
272-
Logger.recordOutput("Stats/IsCounted", isCounted);
273-
}).onlyIf(() -> Constants.getMode() == Mode.REPLAY))
274-
),
275-
276-
Commands.run(() -> {
277-
Logger.recordOutput("Command/ReadyForShoot", isShooterReady());
278-
}),
279-
280-
intake.shakeBalls()
256+
)
281257
).finallyDo(interrupted -> Logger.recordOutput("Command/ShootAtDistance", false));
282258
}
283259

284-
private int ballsShot = 0;
285-
private boolean isCounted = false;
286-
287-
private void addBallToCount() {
288-
ballsShot++;
289-
Logger.recordOutput("Stats/BallsShot", ballsShot);
290-
}
291-
292260
/**
293261
* Spins the shooter up to shoot, without actually shooting.
294262
* @param distance

0 commit comments

Comments
 (0)