In order to control the cargo collecting mechanism we have 2 commands PrepareToCollectCommand and StopCollectingCommand.
Binding this commands to 2 different buttons works like a charm:
// Activate the intake Mecanism (new JoystickButton(m_gameController, Button.kY.value)) .whenPressed(new PrepareToCollectCommand(m_intake, m_storage)); // Deactivate the intake Mechanism (new JoystickButton(m_gameController, Button.kB.value)) .whenPressed(new StopCollectingCommand(m_intake, m_storage));
Now we want to have those commands used within a toggle controlled by 2 simultaneous buttons on the flight sitck
// If both the grip button and trigger are pressed then toggle the intake new JoystickButton(m_flightJoystick, 1 ) .and(new JoystickButton(m_flightJoystick, 2)) .whenActive(new ConditionalCommand( new StopCollectingCommand(m_intake, m_storage), new PrepareToCollectCommand(m_intake, m_storage), m_intake::isActive));
For some reason the Activation works (on False) but the deactivation (on True) is never triggered.
isActive is returning the internal state “m_activated” of the subsystem which is set to true when activated and false when deactivated (state changes using the 2 bindings as shown before)
What are we doing wrong?