|
17 | 17 | #include "behaviortree_cpp/xml_parsing.h" |
18 | 18 | #include "wildcards/wildcards.hpp" |
19 | 19 |
|
20 | | -#ifdef USING_ROS |
21 | | -#include <ros/package.h> |
22 | | -#endif |
23 | | - |
24 | 20 | namespace BT |
25 | 21 | { |
26 | 22 |
|
@@ -196,66 +192,12 @@ void BehaviorTreeFactory::registerFromPlugin(const std::string& file_path) |
196 | 192 | } |
197 | 193 | } |
198 | 194 |
|
199 | | -#ifdef USING_ROS |
200 | | - |
201 | | -#ifdef _WIN32 |
202 | | -const char os_pathsep(';'); // NOLINT |
203 | | -#else |
204 | | -const char os_pathsep(':'); // NOLINT |
205 | | -#endif |
206 | | - |
207 | | -// This function is a copy from the one in class_loader_imp.hpp in ROS pluginlib |
208 | | -// package, licensed under BSD. |
209 | | -// https://github.com/ros/pluginlib |
210 | | -std::vector<std::string> getCatkinLibraryPaths() |
211 | | -{ |
212 | | - std::vector<std::string> lib_paths; |
213 | | - const char* env = std::getenv("CMAKE_PREFIX_PATH"); |
214 | | - if(env) |
215 | | - { |
216 | | - const std::string env_catkin_prefix_paths(env); |
217 | | - std::vector<BT::StringView> catkin_prefix_paths = |
218 | | - splitString(env_catkin_prefix_paths, os_pathsep); |
219 | | - for(BT::StringView catkin_prefix_path : catkin_prefix_paths) |
220 | | - { |
221 | | - std::filesystem::path path(static_cast<std::string>(catkin_prefix_path)); |
222 | | - std::filesystem::path lib("lib"); |
223 | | - lib_paths.push_back((path / lib).string()); |
224 | | - } |
225 | | - } |
226 | | - return lib_paths; |
227 | | -} |
228 | | - |
229 | | -void BehaviorTreeFactory::registerFromROSPlugins() |
230 | | -{ |
231 | | - std::vector<std::string> plugins; |
232 | | - ros::package::getPlugins("behaviortree_cpp", "bt_lib_plugin", plugins, true); |
233 | | - std::vector<std::string> catkin_lib_paths = getCatkinLibraryPaths(); |
234 | | - |
235 | | - for(const auto& plugin : plugins) |
236 | | - { |
237 | | - auto filename = std::filesystem::path(plugin + BT::SharedLibrary::suffix()); |
238 | | - for(const auto& lib_path : catkin_lib_paths) |
239 | | - { |
240 | | - const auto full_path = std::filesystem::path(lib_path) / filename; |
241 | | - if(std::filesystem::exists(full_path)) |
242 | | - { |
243 | | - std::cout << "Registering ROS plugins from " << full_path.string() << std::endl; |
244 | | - registerFromPlugin(full_path.string()); |
245 | | - break; |
246 | | - } |
247 | | - } |
248 | | - } |
249 | | -} |
250 | | -#else |
251 | | - |
252 | 195 | void BehaviorTreeFactory::registerFromROSPlugins() |
253 | 196 | { |
254 | 197 | throw RuntimeError("Using attribute [ros_pkg] in <include>, but this library was " |
255 | 198 | "compiled without ROS support. Recompile the BehaviorTree.CPP " |
256 | 199 | "using catkin"); |
257 | 200 | } |
258 | | -#endif |
259 | 201 |
|
260 | 202 | void BehaviorTreeFactory::registerBehaviorTreeFromFile( |
261 | 203 | const std::filesystem::path& filename) |
|
0 commit comments