splintered-reality / py_trees

Python implementation of behaviour trees.
Other
433 stars 143 forks source link

LSP for behaviour.update #446

Open ndahn opened 4 months ago

ndahn commented 4 months ago

py_trees uses a blackboard as a centralized way for behaviors to interact with each other and retrieve global state information. While the approach and implementation are nice, assuming a blackboard as the only way to pass variables imposes a lot of restrictions.

For example, since you can't have multiple trees with individual blackboards, and if you want to pass something to your behaviors you can never just pass them to the function call. This adds a lot of complexity which I think is not necessary, and for many smaller projects undesirable.

Would it be possible to change the signature of Behaviour.update() to accept *args and **kwargs? This simple change would provide a lot of (optional!) flexibility based on the Liskov substitution principle (LSP), without causing any incompatibilities.