Flash3388 / FlashLib

A robotics development framework
BSD 3-Clause "New" or "Revised" License
10 stars 0 forks source link

Interrupt Callback for `ActionGroup` #87

Closed tomtzook closed 1 year ago

tomtzook commented 2 years ago

As demonstrated in 2022, some groups might want to run motors in a more complex way, which doesn't allow to add a stop call when to a specific action.

One option is to allow a special interruption callable to be added to ActionGroup. This callable will run on the end of said group if wasInterrupted is true.

So, for example:

new SomeAction()
    .andThen(new AnotherAction())
    .alongWith(new ActionAction)
    .whenInterrupted(()-> someSystem.stop())
    .start();

Open a branch from development and work on it.

Remember that there are several ActionGroup types: