View Single Post
  #2   Spotlight this post!  
Unread 14-01-2009, 12:56
foemill's Avatar
foemill foemill is offline
What do you mean it's overweight?
AKA: Eric Miller
FRC #1270 (Red Dragons)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Cleveland, Ohio
Posts: 12
foemill is on a distinguished road
Re: C++ Robot: Simple or Iterative?

Hmmm... well, looking at the virtual functions for SimpleRobot we have:

• virtual void Autonomous ()
• virtual void OperatorControl ()
• virtual void RobotMain ()
• void StartCompetition ()

IterativeRobot has:

• virtual void StartCompetition ()
• virtual void RobotInit ()
• virtual void DisabledInit ()
• virtual void AutonomousInit ()
• virtual void TeleopInit ()
• virtual void DisabledPeriodic ()
• virtual void AutonomousPeriodic ()
• virtual void TeleopPeriodic ()
• virtual void DisabledContinuous ()
• virtual void AutonomousContinuous ()
• virtual void TeleopContinuous ()
• void SetPeriod (double period)
• double GetLoopsPerSec ()

It would appear that one might get finer programmatic control by using IterativeRobot however SimpleRobot has all the main virtuals needed for a decent robot control (IMHO). The big plus for IterativeRobot would be the ability to programmatically set the periodic loop delay. This could be very helpful if you're using PID loops or other time-domain controls. Keep in mind, however, that you don't have to use all the virtual functions if you don't need them. This could simplify the code a great deal. You could also subclass your own IterativeRobot class and "hide" your virtuals.



Quote:
Originally Posted by Abrakadabra View Post
Other threads have touched on this topic a bit, and the User's Guide makes an attempt, but I have yet to see a definitive list of reasons for why I should choose IterativeRobot over SimpleRobot (or vice versa). Do you have any?

For the purposes of this exercise, let's assume that my programming team is very comfortable in C++ and would have no trouble understanding the complexities of the IterativeRobot paradigm. However, we also have very little programming experience invested in the prior seasons, so we're not necessarily more comfortable with one model over the other.

Let's also assume that our robot will want to do some standard but fairly complex tasks: employ a variable-speed turret shooter using a camera to automatically track and fire at opponent's trailer(s) while the robot simultaneously moves around the field collecting balls and keeping a ball inventory for the shooter. These tasks would take place in both teleop and autonomous.

Is there anything that would be very hard or impossible to do in this scenario using SimpleRobot? Anything that mandates Iterative over Simple? How about SimpleRobot combined with the judicious use of Tasks?

Thanks in advance!