setDefaultCommand() equivelent in New Command system

Hello,

I was trying to figure out how you would set a default command for a subsystem this year (or if it is even necessary anymore) For example I want to make the joystick command be the default command for my drivetrain subsystem, but also have other buttons that can control it (while not being the default) How would you do this in the New Command system?

Thanks!

Setting a default command for a subsystem is very easy; one simply calls CommandScheduler.getInstance().setDefaultCommand() , or, more simply, the setDefaultCommand() method of the Subsystem interface

1 Like

Thanks lol - Guess I should have looked harder in the docs

Also take a look at the Command Based Examples, they can give you context about “where” the developers think you should do certain things.
https://docs.wpilib.org/en/latest/docs/software/examples-tutorials/wpilib-examples.html#command-based-examples

ie. The examples put setting the default commands in the RobotContainer class.

1 Like

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