Running a command on robot init

How do you start a command automatically at the beginning of a match and let it run the entire match?

We’re having trouble getting command to run at the beginning of the match automatically. All it does is check the state of a limit switch and light up some LEDs based on the limit switch. It should run the entire match.

We tried starting the command in robotInit, teleopInit and autonomousInit but the command just gets cancelled.


  • Chris

Does your command require a subsystem that has other commands running during normal operation? That would cause it to be cancelled. You could either not have the command require a subsystem (if it’s the only command controlling the LEDs) or make a subsystem that only has LEDs.

If you’re still having trouble, find me tomorrow.

Hi Joe,

Thanks for the reply. Our command doesn’t require the subsystems it uses. But it’s fixed now anyway. We ended up putting the calls in teleopPeriodic and autonomousPeriodic and removing the command.