Stage1b CTRE Solution#94
Conversation
|
🌐 Preview URL: https://pr-94.frcsoftware.pages.dev |
|
This is marked as a draft for now as we're still waiting on alpha 7 to change |
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
left a comment
There was a problem hiding this comment.
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))); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
I would prefer to use awaitAll where appropriate, and I think it's more easily readable than chaining whileTrues.
No description provided.