Quote:
Originally Posted by Kevin Sevcik
So, what's your beef with command based stuff?
|
My major beef with the command based stuff is that it makes it harder to understand the system as a whole. If you have commands that don't complete immediately, it can be hard to know exactly what is happening. You end up at a place with neither a simple set of variables that tells you everything that's going on nor a straightforward callgraph to follow.
Here's a more minor problem: Our autonomous mode became
Code:
correct angle -> shooter speed -> shoot
rather than:
Code:
correct angle-\
+--> shoot
shooter speed-/
Because it was so much easier to just make it a list of commands. So we took longer to shoot things than we needed to. People have mentioned how to work around this in this thread, but it was enough that it didn't happen.
I get that it's also easier to do the steps linearly in non-command based code, but it's not much different. You'd go from:
Code:
switch(mode){
case 0:
run_aim_stuff()
if(aimed) mode=1;
break;
case 1:
turn_on_shooter()
if(up_to_speed) mode=2;
break;
case 2:
shoot()
if(done) mode=3
break;
case 3:
...
}
to
Code:
switch(mode){
case 0:
if(!aimed) run_aim_stuff()
if(!up_to_speed) turn_on_shooter()
if(aimed && up_to_speed){
shoot()
if(done) mode=3
}
break;
case 3:
...
}