Hi everyone, we are a university robotics team which recently switched over from BehaviorTree.CPP to py_trees, and while starting over, we wanted to do things the right way. Just wanted to check in with the community to see if there are any best practices for handling blackboard key conflicts, especially in situations where there are many trees defined across many individual python files.
Currently, we foresee a problem where a key might be poorly named something like "pose", and this might conflict with another key defined with the same name somewhere else (especially when we are implementing quick hot fixes during competitions where good variable naming isn't the top priority).
The py_trees.blackboard.Client does provide a namespace parameter, but then again most common blackboard behaviours in py_trees and py_trees_ros do not expose the namespace parameter of the underlying blackboard client so that it can be set.
What we are currently doing is:
- Define a global
NAMESPACE variable in each python file defining a tree, based on directory structure (this is consistent in our case).
- Use a helper function (that essentially calls
py_trees.blackboard.Blackboard.absolute_name) on all key names before being passed to any behaviours, that prepends the namespace to the key name. However, this can get a bit annoying at times.
- For our own custom behaviours, we designed them to accept a namespace parameter, which the internal blackboard client is initialised with. This way we don't have to apply the helper function to key names every time.
We aren't a 100% happy with this though, especially because of all the repetitive calling of the helper function which clutters up the code quickly. If anyone could share any experience or ideas they have had with a similar issue, that would be much appreciated. Thank you!
Hi everyone, we are a university robotics team which recently switched over from BehaviorTree.CPP to py_trees, and while starting over, we wanted to do things the right way. Just wanted to check in with the community to see if there are any best practices for handling blackboard key conflicts, especially in situations where there are many trees defined across many individual python files.
Currently, we foresee a problem where a key might be poorly named something like "pose", and this might conflict with another key defined with the same name somewhere else (especially when we are implementing quick hot fixes during competitions where good variable naming isn't the top priority).
The
py_trees.blackboard.Clientdoes provide anamespaceparameter, but then again most common blackboard behaviours in py_trees and py_trees_ros do not expose thenamespaceparameter of the underlying blackboard client so that it can be set.What we are currently doing is:
NAMESPACEvariable in each python file defining a tree, based on directory structure (this is consistent in our case).py_trees.blackboard.Blackboard.absolute_name) on all key names before being passed to any behaviours, that prepends the namespace to the key name. However, this can get a bit annoying at times.We aren't a 100% happy with this though, especially because of all the repetitive calling of the helper function which clutters up the code quickly. If anyone could share any experience or ideas they have had with a similar issue, that would be much appreciated. Thank you!