forked from ros-navigation/navigation2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[behavior_tree] Add generate_nav2_tree_nodes_xml (ros-navigation#4073)
* Add generate_nav2_tree_nodes_xml Signed-off-by: Davide Faconti <[email protected]> * behavior_tree: removed list of plugins from yaml Signed-off-by: Davide Faconti <[email protected]> * check result of get_parameter(plugin_lib_names) Signed-off-by: Davide Faconti <[email protected]> * fix previous commit (uncrustify) Signed-off-by: Davide Faconti <[email protected]> * revert change Signed-off-by: Davide Faconti <[email protected]> --------- Signed-off-by: Davide Faconti <[email protected]>
- Loading branch information
1 parent
92da6e5
commit aa00f34
Showing
13 changed files
with
120 additions
and
532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
// This was automativally generated by cmake | ||
namespace nav2::details | ||
{ | ||
const char* BT_BUILTIN_PLUGINS = "@plugin_libs@"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2024 Davide Faconti | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. Reserved. | ||
|
||
#include <vector> | ||
#include <string> | ||
#include <fstream> | ||
#include <boost/algorithm/string.hpp> | ||
|
||
#include "behaviortree_cpp_v3/behavior_tree.h" | ||
#include "behaviortree_cpp_v3/bt_factory.h" | ||
#include "behaviortree_cpp_v3/utils/shared_library.h" | ||
#include "behaviortree_cpp_v3/xml_parsing.h" | ||
|
||
#include "plugins_list.hpp" | ||
|
||
int main() | ||
{ | ||
BT::BehaviorTreeFactory factory; | ||
|
||
std::vector<std::string> plugins_list; | ||
boost::split(plugins_list, nav2::details::BT_BUILTIN_PLUGINS, boost::is_any_of(";")); | ||
|
||
for (const auto & plugin : plugins_list) { | ||
std::cout << "Loading: " << plugin << "\n"; | ||
factory.registerFromPlugin(BT::SharedLibrary::getOSName(plugin)); | ||
} | ||
std::cout << "\nGenerating file: nav2_tree_nodes.xml\n" | ||
<< "\nCompare it with the one in the git repo and update the latter if necessary.\n"; | ||
|
||
std::ofstream xml_file; | ||
xml_file.open("nav2_tree_nodes.xml"); | ||
xml_file << BT::writeTreeNodesModelXML(factory) << std::endl; | ||
xml_file.close(); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.