Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on Recommended Usage of Blackboard #429

Open
songyuc opened this issue Nov 27, 2023 · 1 comment
Open

Clarification on Recommended Usage of Blackboard #429

songyuc opened this issue Nov 27, 2023 · 1 comment

Comments

@songyuc
Copy link

songyuc commented Nov 27, 2023

Hello guys,

I am currently working with py_trees and I'm seeking some clarification on best practices for using the blackboard feature. I have previously used a basic approach for blackboard usage, which involves directly setting and getting values on the blackboard. Here's a brief example of what I've done:

import py_trees

def example():
    # Creating a blackboard instance
    blackboard = py_trees.blackboard.Blackboard()

    # Setting data
    blackboard.set("robot_battery_level", 100)

    # Getting data
    battery_level = blackboard.get("robot_battery_level")
    print(f"Robot battery level: {battery_level}")

if __name__ == '__main__':
    example()

While this method works for basic scenarios, I am aware that py_trees also offers more sophisticated mechanisms like using the py_trees.blackboard.Client class for managing blackboard access. I would like to know if the approach I am using is in line with the recommended practices, or if it's more advisable to use the Client class for blackboard interactions, especially in more complex behavior trees.

Any guidance or clarification you can provide on this matter would be greatly appreciated. I am especially interested in understanding the best practices for blackboard usage in py_trees to ensure efficient and effective implementation in my projects.

Thank you for your time and assistance.

Best regards,
Yucheng Song

@CleanBandit5595
Copy link

I think the Client API is useful when passing a specific namespace to be a client of. Then you only need to pass the relative blackboard key name. This way you can organize the blackboard better with some behaviours only referencing some specific namespaces of the blackboard.
However, I would also very much appreciate more best practices for blackboard usage, and py_trees in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants