Team2168 / 2022_Main_Robot

Other
3 stars 0 forks source link

fixed old dwl binding #56

Closed natejank closed 2 years ago

jcorcoran commented 2 years ago

I don't quite understand what the intent is here.
Did something not work with the original code?

Looks like you just swapped the order of commands.

This isn't a command group. It's equivalent to running the two methods against the object on the first line. E.g.:

oi.driverJoystick.ButtonLeftStick().whenHeld(new DriveWithLimelight(drivetrain, lime, oi::getGunStyleTrigger));
oi.driverJoystick.ButtonLeftStick().whenPressed(new RotateTurret(turret, 0.0));

This works because the whileX / whenX methods in the Button class returns a copy of itself in wpilibj2: https://team2168.org/javadoc/wpilib/edu/wpi/first/wpilibj2/command/button/Button.html#whileHeld(edu.wpi.first.wpilibj2.command.Command)

natejank commented 2 years ago

before the hood wouldn't zero, so I think order matters? I can make it a command group so it's more specific.

Either that or the issue doesn't exist, but we had run into it at drive practice?

jcorcoran commented 2 years ago

Kinda doesn't make sense... There's plenty of other instances of chained methods in RobotContainer.

No other branches have this change in it right? But i saw the shooter zero today at the shop running the auto branch when firing from the fender position.

I explained why what I'm saying is correct from a language feature perspective.

Maybe test scenario where it didn't work wasn't running the code you thought it was? Did you re-deploy?

Same syntax is currently used for:

jcorcoran commented 2 years ago

image https://docs.wpilib.org/en/stable/docs/software/commandbased/binding-commands-to-triggers.html