We’re trying to bind a command we wrote, named “ToggleIntakeExtend”, to a button on our XboxController class, but the “JoystickButton.whenPressed()” command is throwing the error “The method whenPressed(Command) in the type Button is not applicable for the arguments (ToggleIntakeExtend)”
Here is the code that we have written in RobotContainer.java:
public class ToggleIntakeExtend extends CommandBase {
Intake m_intake;
Pneumatics m_pneumatics;
boolean toggled = false;
/** Creates a new ToggleIntakeExtend. */
public ToggleIntakeExtend(Intake intake) {
m_intake = intake;
addRequirements(intake);
// Use addRequirements() here to declare subsystem dependencies.
}
// Called when the command is initially scheduled.
@Override
public void initialize() {
}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}
There was some code in here, but we were in the process of rewriting it when I copied this over. The code inside was super simple and doesn’t really matter for the problem we’re having.
I like where you’re going, but there’s only one CommandBase. But there are two JoystickButton’s for old and new Command Framework. I suspect JoystickButton is being imported from the old command framework.
@jarb Assuming I’m right, you should remove the old command vendor dep and update your code.