Skip to content

Stage1b CTRE Solution#94

Draft
Daniel1464 wants to merge 4 commits into
frcsoftware:mainfrom
Daniel1464:stage1bCtreSolution
Draft

Stage1b CTRE Solution#94
Daniel1464 wants to merge 4 commits into
frcsoftware:mainfrom
Daniel1464:stage1bCtreSolution

Conversation

@Daniel1464

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

Copy link
Copy Markdown

🌐 Preview URL: https://pr-94.frcsoftware.pages.dev

@Daniel1464

Copy link
Copy Markdown
Contributor Author

This is marked as a draft for now as we're still waiting on alpha 7 to change extends Mechanism to implements Mechanism.

@DylanB5402

DylanB5402 commented Jul 19, 2026

Copy link
Copy Markdown
Member

This is marked as a draft for now as we're still waiting on alpha 7 to change extends Mechanism to implements Mechanism.

Does this have to be a blocker? I'd rather merge this in early and go back to make code changes once alpha 7 is out

@DylanB5402 DylanB5402 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like this a lot, thank you for picking it up! Left a couple small comments, apologies if I'm jumping the gun on reviewing here

@Override
public void start() {
Scheduler.getDefault()
.schedule(robot.drivetrain.arcadeDrive(() -> 0.5, () -> 0.0).withTimeout(Seconds.of(4)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we break this out into its own command in the Drive subsystem, like the turn in place one? I think it'd be good to use this as an example of how to compose commands for more complex behaviors (Ex: drive, turn, drive again)

robot.drivetrain.setDefaultCommand(
robot.drivetrain.arcadeDrive(() -> -xbox.getLeftY(), () -> xbox.getRightX()));

xbox.leftBumper().whileTrue(robot.intakeLauncher.intake()).whileTrue(robot.feeder.intake());

@DylanB5402 DylanB5402 Jul 19, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Might just be a commands v3, but I find having two whileTrue() calls in a row like that is a bit weird to read? commands v2 had the alongWith() helper, does v3 have anything similar we could use?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The commands v3 docs mention that you can chain whileTrue calls together, as well as running 2 commands in parallel inside of a parent command with awaitAll:

Command.noRequirements(coro -> {
   System.out.println("Hi!");
   coro.awaitAll(command1, command2);
})

In V3, you can also use alongWith like this:

robot.launcher.intake().alongWith(robot.feeder.intake()).withAutomaticName()

But IMO the withAutomaticName is a lot less intuitive, and I didn't mention alongWith since it does a very similar thing to awaitAll.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I kinda like awaitAll since it mirrors more typical async language feature (ex: Javascript's Promise.all). @zachwaffle4 as our resident commands v3 expert do you have opinions?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would prefer to use awaitAll where appropriate, and I think it's more easily readable than chaining whileTrues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants