View Single Post
  #19   Spotlight this post!  
Unread 20-02-2012, 03:15
Sunstroke Sunstroke is offline
Programmer
AKA: Joe Grinstead
FRC #3504 (Girls of Steel)
Team Role: Mentor
 
Join Date: Apr 2009
Rookie Year: 2009
Location: New England
Posts: 49
Sunstroke is an unknown quantity at this point
Re: What is the point of timer.delay?

Quote:
Originally Posted by gixxy View Post
I know that if you put in a Timer.delay() it will delay EVERYTHING. I put in a 4 second delay on a command to stop it from being called too often, but during that 4 seconds I couldn't do anything, the DriveTrain,our BallFeed belt. everything was frozen.
The command system is actually not multithreaded. There is one thread that goes around and constantly calls the initialize/execute/... on each running command. So using Timer.delay in a command is a terrible idea.

However, you can use the WaitCommand in a command group, or you can use the timeSinceInitialized() method built into each command to do some timing based code.
Reply With Quote