Naming Commands within Command-Based Groups

My team is starting to learn Command-Based and the CommandScheduler onCommandXXXXXX looked like nice additions for troubleshooting. The docs example shows ShuffleBoard events and I added Data Log Tool logging to the example.

Using, for example, the SequentialCommandGroup only the name of the group is available. I can change it with setName/.withName and that is slightly helpful. What I want is to see the interior commands of the group. I’ve tried a few different structures for defining commands in the grouping but the names of the individual commands don’t seem to be triggering the onCommandXXXXXX with their individual names.

Is naming restricted to the group or am I mssing some code to get the details to work? Thanks.

1 Like

enhance Command Sendable impls by Starlight220 · Pull Request #4735 · wpilibsuite/allwpilib · GitHub adds the component names to the Sendable representation of the composition, but there’s still not really a way to get member names programmatically from the composition object (and there shouldn’t, either – commands shouldn’t be used outside their composition).

Anyway, the onCommandXXX listeners don’t register composed commands anyway (the scheduler doesn’t see them).

Perhaps composing commands as proxy could help you? Instead of passing the command itself to the composition, a proxy command would be used for synchronization in the composition, while the proxied command would be seen by the scheduler.

1 Like

Thanks for the hint. I use a lot of timeouts and they create Parallel groups that have the original problem. I see all the proxy commands are scheduled at once instead of sequentially as they end. Didn’t look like .andThen would fix that as that creates a Sequential group with the problem. Otherwise the proxy worked exactly as advertised and the names of all the ungrouped commands appear correctly - it’s just that everything I wanted to do was decorated and groups implied.