refine_plan.algorithms.policy_to_bt
A converter from deterministic memoryless policies to behaviour trees.
This is an implementation of the work in: Gugliermo, S., Schaffernicht, E., Koniaris, C. and Pecora, F., 2023. Learning behavior trees from planning experts using decision tree and logic factorization. IEEE Robotics and Automation Letters.
This code is reimplemented from: https://github.com/SimonaGug/BT-from-planning-experts
The above code is by the lead author of the above paper, and HAS NO LICENSE ATTACHED. Though there is no license, the code is open source.
The reimplementation fixes a number of bugs in the linked implementation. It also streamlines data conversions and makes other tidiness/quality of life improvements.
Note that the linked repo could not be used directly for REFINE-PLAN; the reimplementation is necessary.
Author: Charlie Street Owner: Charlie Street
Module Contents
Classes
This class contains the functionality to convert a policy into a BT. |
- class refine_plan.algorithms.policy_to_bt.PolicyBTConverter(default_action='None')
Bases:
object
This class contains the functionality to convert a policy into a BT.
- _vars_to_conds
A dictionary from variable names to Condition objects.
- _vars_to_symbols
A dictionary form variable names to sympy symbols.
- _default_action
A default action which replaces all None actions in the policy. This is necessary as policies for SSPs return None at the goal state, for example, and the BT doesn’t know how to execute this.
- _default_needed
Is the default action needed in a given BT?
- convert_policy(policy, out_file=None)
Convert a Policy into a BehaviourTree and write the BT to file.
- Parameters:
policy – A deterministic, memoryless policy
out_file – Optional. The output file for the BT
- Returns:
The converted BT