Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,13 @@ public Command statusMessage(String message) {
/**
* Drives to the neutral zone ball pit, deploys the intake, drives across to collect balls.
*/
public Command collectFromNeutralZone() {
public Command collectFromNeutralZone(Command collectorWaitCommand) {
var group = new SequentialCommandGroup();
group.setName("CollectFromNeutralZone");

group.addCommands(driveToNeutralZoneProvider.get());
group.addCommands(new ParallelDeadlineGroup(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐ ⭐ ⭐ I suspect this isnt quite going to work, let's talk about it in person. Wrapping a single command in a ParallelDeadlineGroup basically is a noop. I thought you wanted to run the collector while driving back but they are in sequence now?

driveToNeutralZoneProvider.get(),
collectorWaitCommand.andThen(collectorIntakeProvider.get())));

group.addCommands(new ParallelDeadlineGroup(
firstDriveForCollectionCommandProvider.get(),
Expand All @@ -146,11 +148,13 @@ public Command collectFromNeutralZone() {
/**
* Drives to the neutral zone ball pit, deploys the intake, drives across to collect balls.
*/
public Command collectFromNeutralZoneSecond() {
public Command collectFromNeutralZoneSecond(Command collectorWaitCommand) {
var group = new SequentialCommandGroup();
group.setName("CollectFromNeutralZoneSecond");

group.addCommands(driveToNeutralZoneSecondTimeProvider.get());
group.addCommands(new ParallelDeadlineGroup(
driveToNeutralZoneSecondTimeProvider.get()
collectorWaitCommand.andThen(collectorIntakeProvider.get())));

group.addCommands(new ParallelDeadlineGroup(
secondDriveForCollectionCommandProvider.get(),
Expand All @@ -172,7 +176,6 @@ public Command driveToAllianceAndShoot(Command shootingDeadline) {
prepareToShoot.setPresetLocation(TrajectoriesCalculation.PresetShootingDistance.TRENCH);
group.addCommands(new ParallelDeadlineGroup(
driveFromNeutralZoneToAllianceProvider.get(),
collectorStopProvider.get(),
prepareToShoot));

var continuousPrepare = continuousPrepareToShootProvider.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ public CollectAndShootTwiceCommand(
pf.setPrefix(this.getName());
var firstShotTimeout = pf.createPersistentProperty("First shot timeout seconds", 3.0);
var secondShotTimeout = pf.createPersistentProperty("Second shot timeout seconds", 10.0);
var collectorWait = pf.createPersistentProperty("Collector run wait seconds", 1.0);

addCommands(
auto.extendIntake(),
auto.collectFromNeutralZone()
auto.collectFromNeutralZone(new WaitForDurationCommand(collectorWait::get))
.alongWith(auto.statusMessage("Driving to neutral zone and back")),
auto.driveToAllianceAndShoot(
auto.waitForShootingDone().raceWith(new WaitForDurationCommand(firstShotTimeout::get)))
.alongWith(auto.statusMessage("Driving to alliance and shoot")),
auto.stopShooting().alongWith(auto.extendIntake()),
auto.collectFromNeutralZoneSecond()
auto.collectFromNeutralZoneSecond(new WaitForDurationCommand(collectorWait::get))
.alongWith(auto.statusMessage("Driving to neutral zone and back the second time")),
auto.driveToAllianceAndShoot(new WaitForDurationCommand(secondShotTimeout::get))
.alongWith(auto.statusMessage("Driving to alliance and shoot")));
Expand Down
Loading