Introducing the SMACC State Machine Library

Time to join the conversation, I guess (people who know me probably were waiting for this to happen :wink:).

First of all, let me tell you that it is a good thing that there are multiple solutions available in the community to solve the problem of task planning.

If SMACC can offer that, it is great. Let’s also remember RAFCON, for the sake of completeness.

Secondary, I don’t have any particular interest in saying that Behavior Trees are great. Actually, I have the feeling that they are different from Hierarchical State Machines, but not necessary better.

I have no agenda and even if I spent 1 year in my career developing trying to implement the absolute best implementation of BT, BehaviorTree.CPP, but I will be happy to throw it in the garbage as soon as I find a better solution.

Said that, I must reply to the comments about the SMACC vs BT comparison mentioned earlier and the comments from @brettpac.

I am trying to be as fair as I can and not “partisan” in any way :stuck_out_tongue_winking_eye:

Orthogonality/Concurrency

It is not true that BT can’t provide it, in fact, the number one priority of BT.CPP was to find a valid model of Reactive Behaviors, using ReactiveSequence, ParallelNode, etc.

We may argue which approach is better or more intuitive, but eventually the user is the ultimate judge.
I don’t have a strong opinion myself and maybe SMACC can do that better, who knows ?

Poor scalability, no real-time, many threads etc.

Again, mostly false or implementation dependent. BT.CPP discourage those Actions that spawns their own thread, even if that is possible.

On the other hand, I admit that the event-based approach is better than the “polling” (AKA “check conditions in a loop”) approach.
But there is no reason why that can’t be implemented in BT too (who knows, maybe in the future).

Readability

Some things are more readable in Behavior Trees, others are in State Machines.
The argument and example of “bake a cake”, provided in the page, is unfair and misleading, to say the least.

BT force you to think about what happen if an action fails. If you add that to State Machines too (you should) your SM will be equally or more complex that a BT.

“States really do exist”

Here I agree with the author. I realized that this is something where BT struggle.

No problem admitting that it is the biggest weakness of BT.

“Only for games” and “not used on real robots”

Don’t tell my boss, because we use them on our 1 tonne robot.

Summarizing…

Everybody is entitled to have his/her own opinion ¯_(ツ)_/¯,

My opinion is: use the paradigm and the implementation that makes you more productive.

15 Likes