View Single Post
  #3   Spotlight this post!  
Unread 14-01-2009, 14:07
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,738
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: C++ Robot: Simple or Iterative?

I don't think my team has decided yet which one they'll use, but here are my opinions:

Simple robot is just that - simple. The structure of the code allows you absolute freedom in your design. Of course, with that freedom comes a little responsibility - you have to make sure you don't screw it up . I haven't looked terribly deeply into multithreading (or tasks, as they call it) yet, but we'll probably be using it this year. From past experience, you have to be pretty careful about launching threads in loops, or you might end up with a hundred threads all trying to do the same thing. With the simple robot, you don't have to worry as much about that, as there are no built in loops - you create them yourself!

The Iterative robot is the same type of set up we've had in previous years - an init, a fast loop, and a slow loop. For teams that have a lot of experience with those, it's a great thing to use. for teams that don't know what they're doing, the built in looping structure can be a great way to ensure that your inputs and outputs are persistent throughout the competition period. Of course, launching new threads inside one of the loops could be very problematic...


Personally, i don't like having a lot of structure imposed on me by code. I would rather do (sudo code with made up values):
Code:
void Autonomous ()
{
drive straight
wait 3 seconds
turn left
wait 2 seconds
drive straight
wait 4 seconds
stop
}
than
Code:
public int counter = 0
void AutonomousContinuous ()
{
if (counter<300)
drive straight
else if (counter < 500)
turn left
else if (counter < 1000)
drive straight
else
stop
counter++
}
I just fine the top snippet more intuitive and easier to control than the bottom one. I think it's also a little easier to test and refine.