View Single Post
  #14   Spotlight this post!  
Unread 09-06-2012, 19:46
Slix Slix is offline
Registered User
AKA: Peter Kowalczyk
FRC #2115 (NightMares)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2010
Location: Mundelein, IL
Posts: 31
Slix is an unknown quantity at this point
Re: Multitasking in Java

Quote:
Originally Posted by vinnie View Post
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.

Last edited by Slix : 09-06-2012 at 21:01.
Reply With Quote