-
Notifications
You must be signed in to change notification settings - Fork 696
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
How to get a list of the Blackboard keys from a node? #188
Comments
You just found a bug. Thanks for the accurate report. Fixed ! |
@facontidavide I've just tried @lstelzner method with a custom logger callback function like this:
however I also seem to get a segfault when getKeys() is called. I'm run this with version 3.5.0, that I've got from debs (ros-melodic-behaviortree-cpp-v3). I've tried changing my tree to something minimal, however the problem was still there. Would you have any thoughts on what could be the issue? |
I would like to fix this ASAP. Is there a simple code that I can use to replicate the error? |
@facontidavide I'll try to create a repo with minimal crashing example in the next hour or so, will keep you posted. |
I've made a short repo that reproduces the issue for me here: /~https://github.com/msadowski/bt_logger_test If you build this with catkin and use the bt.launch file then it should hopefully fail (at least it does for me). Hope this repo helps! Also please let me know if I'm doing anything wrong there |
There is a typo in your code
You should write
You are accessing a nullptr 😛 I was digging into my own code and realized that when any Node (including my own) has only this kind of constructors
But not this one
That node will not have a pointer to the blackboard, since that pointer is actually a field of NodeConfiguration. So, from my point of view it makes sense because I strongly discourage using the blackboard, ports should be used instead. What do you think? |
Hi Davide, Thanks for spotting the mistake and for the explanation (I think the Your approach makes a perfect sense, especially that you discourage using blackboard. I'll make sure that all my nodes have ports and I'll be good! I think you can close this issue back! Many thanks for the feedback! |
I'm creating a class that inherits from
BT::StatusChangeLogger
. In this class I want to collect extra data including what is currently in the nodes' Blackboard (keys/values) at the time of thecallback
function. Since my tree has multiple nodes with various input and output ports, I do not know the key strings from within callback. I've been trying the following but it crashes once it reachesgetKeys()
.In running in a debugger an exception happens on
out.reserve( storage_.size() );
BehaviorTree.CPP/src/blackboard.cpp
Line 78 in cc3f0d9
Leading me to suspect maybe my method of getting the blackboard is incorrect.
Is what I want to do supported by the API, and if so what is the correct way to do it?
Thanks.
The text was updated successfully, but these errors were encountered: