View Single Post
  #10   Spotlight this post!  
Unread 27-01-2017, 09:14
dmelcer9 dmelcer9 is offline
Registered User
AKA: Daniel
FRC #0810 (Mechanical Bulls)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2012
Location: Smithtown
Posts: 51
dmelcer9 is an unknown quantity at this point
Re: Building Commands at Runtime

But with a command group, any subsystems that the command group requires are "required" for the whole command group sequence. In the MultipleAutonomousStarter, a subsystem is only required while that specific command is executing. If (for example) step 1 of a command group is to move the camera to location x and step 4 is to line up using reflective tape, I don't want the driver manually moving the camera or some other command firing to move the camera to center or something like that.

Also, let's say you want to add a third step. For all of these approaches, you need to add a sendablechooser and some commands or suppliers of commands. With option 1 or 2, you than add one line of code in the constructor. With 3, you also need to modify the handoff sequence and the interrupted method.

You can't guarantee that another programmer won't use the same instance of the command elsewhere. With a supplier, if they get a duplicate (but different) instance and start it while the command group is running, there is a requires conflict, your command group stops. You don't get the auto points, but not too catastrophic. Someone adds the same instance of a command you are using to their own command group? You get an exception when you start your command, even if the command group hasn't even run yet. Robot code crashes. Oops.
Reply With Quote