I’m having a problem setting up default commands. Using debugging by setting values on shuffleboard, I can tell that the default commands gets initialized but isn’t scheduled, meaning that the execute() method isn’t called.
I’m very confused as to why this is? It doesn’t make any sense to me
Relevant code:
TeleopDriveCommand execute()
@Override
public void execute() {
//squares input in second term. first term re-multiplies the negative if there was one bc squaring removes the negative
m_fwd = (m_controllerSubsystem.controllerY() > 0 ? 1 : -1) * (-Math.pow(m_controllerSubsystem.controllerY(), 2));
m_rot = -(m_controllerSubsystem.controllerX() > 0 ? 1 : -1) * (Math.pow(m_controllerSubsystem.controllerX(), 2));
m_driveSubsystem.arcadeDrive(m_fwd, m_rot);
}
Where default commands are set
public RobotContainer() {
//Configure default commands
CommandScheduler.getInstance().setDefaultCommand(m_robotDrive, new TelopDriveCommand(m_robotDrive, m_controllerSubsystem));
CommandScheduler.getInstance().setDefaultCommand(m_armSubsystem, new ArmMoveCommand(m_armSubsystem, m_controllerSubsystem));
}
Can you link to your repository? It’s impossible to help from these snippets alone.
It looks like you’re doing things very strangely, though. You should not have a subsystem for your controllers; the point of the Subsystem class is primarily to provide hardware mutexes for Commands through the requirement API. There’s no reason to guard access to your HID devices with a mutex.
Your default commands are cancelling each other because they’re both trying to hold the ControllerSubsystem mutex. See my advice above about why it’s not appropriate to use Subsystem there.
You can keep your HID wrapper class mostly as-is if you really want, just don’t make it extend Subsystem.
I’d suggest looking at the RapidReactCommandBot example project for some inspiration as to how you could structure this differently, though. It’s not great practice to touch HID inputs directly from command implementations.