Is there a trick to get the default command on a subsystem to run during autonomous?
If you don’t schedule any other commands that use that subsystem, the default command will get scheduled during autonomous as well.
So… default command is on indexer.
If you have a sequential command group and one of the commands in the group uses the indexer. Does the default command on the indexer not run while the entire sequential command group runs?
That’s correct. Command groups use the union of all of the subsystems all of the commands in them use.
Thanks. Well, that explains it, but I’m struggling to figure out how to use the framework appropriately…
So, the default command on the indexer is doing house keeping.
For autonomous we string together a list of commands ending in “shoot”. Shoot also uses the indexer. But during the lead up to the shoot the command use the intake to consume the power cells, but since the indexer’s default command isn’t running (due to the shoot command being in the sequential group) it doesn’t to the “house keeping” to index them appropriately.
Do we just construct our own “state machine” or is there an easier way?
My suggestion would be to explicitly schedule the command to do the “indexer housekeeping” at the beginning of the autonomous program. It could even be the same command as the “default command” but an explicit invocation of it.
If it’s doing housekeeping, and not actually driving an actuator, you can put that code in the Subsystem’s periodic() function instead of having it in a command at all.
Hmmmm. What about using the provided ScheduleCommand class? That looks like it would prevent the scheduler from doing the union on the requirements because the requirements wouldn’t be known until the command gets scheduled… We’ll try that… Putting the shoot command in a ScheduleCommand “wrapper”.
That is a good suggestion, the trick is that the long string of commands uses a common subsystem and therefore stops it. But thanks, we tried!
Another explanation
Potential solution is to run commands in parallel, ie run the indexers index command in parallel with your intake command.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.