Closed JakobDomislovic closed 1 year ago
You could subclass BehaviourTree
and write your own setup method that handles things as you need to. There's actually not much to the setup function, so this should not be too hard. See https://github.com/splintered-reality/py_trees/blob/devel/py_trees/trees.py#L47 - it's just using a threaded timer that relays to a callback that triggers the kill signal.
You could instead replace that with something that logs to the screen (downside: doesn't save you from a setup which hangs - you'll have to kill it from the outside).
Alternatively, if your paradigm permits it, you can use the multiprocessing
module. See https://github.com/splintered-reality/py_trees/commit/d7be59dd9944ecbd5ecfb41d8f0fd00fe99daad1 for details.
If you decide on something generic that you think others might make use of, let me know - we can replace, or at least implement an alternative pathway for setup
in this library.
I am doing setup() method (from _pytrees.trees.BehaviourTree()) in non-main thread and I am getting following error:
ValueError: signal only works in main thread
. How to deal with this without transferring setup() method in the main thread? I am also providing the whole trace below :)