Command Scheduler in Java

Hello CD Friends,

Our team is new to using Java, as we previously used LabView. This year we are switching to Command-Based Java, which we are excited about. One thing that both our mentors and I are confused on is the Command Scheduler. We realize that you can set a default command for a specific subsystem, but is there anyway to go against the default command? If anyone has any knowledge on this it would be greatly appreciated.

Another problem we have been having is running autons. We have been deploying the code but we do not know how to label it as an autonomous in the driver station. The code will not run even though no errors are displayed.

Thank you for any help!

1 Like

Per the documentation:

“Default commands” are commands that run automatically whenever a subsystem is not being used by another command.

2 Likes

As far as auto, you want to select autonomies instead of teleoperated in the DS above the enable disable buttons. If you have done that then we need to see code to help more.

It might be helpful also to mention the description of the run method from the Javadoc for CommandScheduler (written by @Oblarg by the way). run() is called on each iteration of the main robot loop.

Runs a single iteration of the scheduler. The execution occurs in the following order:

Subsystem periodic methods are called.

Button bindings are polled, and new commands are scheduled from them.

Currently-scheduled commands are executed.

End conditions are checked on currently-scheduled commands, and commands that are finished have their end methods called and are removed.

Any subsystems not being used as requirements have their default methods started.
1 Like

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