| 204 | } |
| 205 | |
| 206 | BehaviorTreeConstPtr BehaviorDatabase::buildTree(Json const& config, StringMap<NodeParameterValue> const& overrides) const { |
| 207 | StringSet scripts = jsonToStringSet(config.get("scripts", JsonArray())); |
| 208 | auto tree = BehaviorTree(config.getString("name"), scripts, config.getObject("parameters", {})); |
| 209 | |
| 210 | StringMap<NodeParameterValue> parameters; |
| 211 | for (auto p : config.getObject("parameters", {})) |
| 212 | parameters.set(p.first, p.second); |
| 213 | for (auto p : overrides) |
| 214 | parameters.set(p.first, p.second); |
| 215 | BehaviorNodeConstPtr root = behaviorNode(config.get("root"), parameters, tree); |
| 216 | tree.root = root; |
| 217 | return std::make_shared<BehaviorTree>(std::move(tree)); |
| 218 | } |
| 219 | |
| 220 | Json BehaviorDatabase::behaviorConfig(String const& name) const { |
| 221 | if (!m_configs.contains(name)) |
no test coverage detected