Quote:
Originally Posted by vinnie
I haven't seen it documented anywhere, but I have set motors within Commands, which is WPILib's overly simplified (to a fault I think) system of threading, which I would assume uses the default Thread class.
|
Commands don't use threads. They are scheduled.
When the user's code runs the Scheduler's run() method, the scheduler iterates through a list of active commands and calls execute() on each one (sequentially, not parallel).
So there's no issues with race conditions or anything complicated like that with the new command-based system, since there's no threads. I thought commands were useful because we could easily make the robot perform actions by binding button presses to Commands. It also made it easy for our robot to sequentially fire balls during autonomous just by scheduling three of our "shoot ball" Commands to run using a CommandGroup.