"onFalse" repeatedly being called in command based programming

Hey everyone!

We’re new to the command based robot programming type, and we are testing the Trigger onFalse and whileTrue commands. From what we can tell, onFalse should only be called when the JoystickButton is released in this piece of code, but it is repeatedly being called. Do you guys know how to make it only call once when the button is released?

      })).onFalse(new RunCommand(()->{System.out.println("stopping");}));
      (new JoystickButton(m_armController, 10)).whileTrue(new RunCommand(()->{
      })).onFalse(new RunCommand(()->{System.out.println("stopping");}));


You are starting a RunCommand. That will run repeatedly or until interrupted and start when you release the button. If you want it to go once do an InstantCommand.

Thank you so much!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.