Skip to content

Best practices to handle namespacing to avoid blackboard key conflicts? #467

@advaypakhale

Description

@advaypakhale

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:

  1. Define a global NAMESPACE variable in each python file defining a tree, based on directory structure (this is consistent in our case).
  2. 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.
  3. 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions