View Single Post
  #22   Spotlight this post!  
Unread 27-08-2014, 13:21
jfitz0807 jfitz0807 is offline
Registered User
FRC #2877 (Ligerbots)
Team Role: Parent
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Newton, MA
Posts: 67
jfitz0807 is an unknown quantity at this point
Re: What base class do you use when programming?

Would someone please explain the difference between a CommandBased robot and an IterativeRobot?

We went to java in 2012 and started with the RobotBuilder tool. It generated a code skeleton derived from IterativeRobot. The IterativeRobot class is contained in sunspotfrcsdk\lib\wpilibj.src\edu\wpi\first\wpilib j. I have not been able to find a CommandBased class in the wpilib.

The IterativeRobot is "command based" in the sense that on every iteration of the control loop, it executes any active commands. I'm not sure how a CommandBased robot would be any different.

As for multi-threading, we can get into a theoretical discussion on the merits of multi-threading on a single CPU platform. In general, I prefer the explicit control of keeping things single threaded and using the setInterruptible or cancel methods if I need to preempt a running command.

But this would be a discussion for a separate thread (so to speak).