"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?

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

Thanks!

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.