Skip to content

Commit

Permalink
documentation and doc correction
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Aug 17, 2022
1 parent 8db5593 commit 98c03c8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/tutorial_07_multiple_xml.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ int main()

// Register the behavior tree definitions, but don't instantiate them, yet.
// Order is not important.
factory.registerBehaviorTreeFromText("main_tree.xml");
factory.registerBehaviorTreeFromText("subtree_A.xml");
factory.registerBehaviorTreeFromText("subtree_B.xml");
factory.registerBehaviorTreeFromFile("main_tree.xml");
factory.registerBehaviorTreeFromFile("subtree_A.xml");
factory.registerBehaviorTreeFromFile("subtree_B.xml");

//Check that the BTs have been registered correctly
std::cout << "Registered BehaviorTrees:" << std::endl;
Expand Down
20 changes: 19 additions & 1 deletion include/behaviortree_cpp_v3/bt_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,11 @@ class BehaviorTreeFactory
/// Remove a registered ID.
bool unregisterBuilder(const std::string& ID);

/// The most generic way to register your own builder.
/** The most generic way to register a NodeBuilder.
*
* Throws if you try to register twice a builder with the same
* registration_ID.
*/
void registerBuilder(const TreeNodeManifest& manifest, const NodeBuilder& builder);

template <typename T>
Expand Down Expand Up @@ -293,10 +297,24 @@ class BehaviorTreeFactory
*/
void registerFromROSPlugins();

/**
* @brief registerBehaviorTreeFromFile.
* Load the definition of an entire behavior tree, but don't instantiate it.
* You can instantiate it later with:
*
* BehaviorTreeFactory::createTree(tree_id)
*
* where "tree_id" come from the XML attribute <BehaviorTree ID="tree_id">
*
*/
void registerBehaviorTreeFromFile(const std::string& filename);

/// Same of registerBehaviorTreeFromFile, but passing the XML text,
/// instead of the filename.
void registerBehaviorTreeFromText(const std::string& xml_text);

/// Returns the ID of the trees registered either with
/// registerBehaviorTreeFromFile or registerBehaviorTreeFromText.
std::vector<std::string> registeredBehaviorTrees() const;

/**
Expand Down

0 comments on commit 98c03c8

Please sign in to comment.