So I have this code here to control a mechanism:
m_Controller.a().onTrue(
CommandUtililty.balanceCommand()
);
but the problem is that when I release the button, It doens’t stop the command, it just continues. Is there a method that I can call instead of onTrue that will have the functionality i need? Thanks!!
Here is the command code:
public static Command balanceCommand() {
return new RunCommand(
() -> m_DriveSubsystem.tankDrive(
m_DriveSubsystem.getPitchController().calculate(
-m_DriveSubsystem.getRobotPitch(),
0
)
)
).until(
() -> m_DriveSubsystem.getPitchController().atSetpoint()
);
Thanks!!