38 #include <pluginlib/class_loader.hpp>
39 #include <boost/tokenizer.hpp>
40 #include <rclcpp/logger.hpp>
41 #include <rclcpp/logging.hpp>
42 #include <rclcpp/parameter_value.hpp>
47 static const rclcpp::Logger
LOGGER = rclcpp::get_logger(
"moveit_ros.constraint_sampler_manager_loader");
52 Helper(
const rclcpp::Node::SharedPtr& node,
const constraint_samplers::ConstraintSamplerManagerPtr& csm) : node_(node)
54 if (node_->has_parameter(
"constraint_samplers"))
60 constraint_sampler_plugin_loader_ =
61 std::make_unique<pluginlib::ClassLoader<constraint_samplers::ConstraintSamplerAllocator>>(
62 "moveit_core",
"constraint_samplers::ConstraintSamplerAllocator");
64 catch (pluginlib::PluginlibException& ex)
66 RCLCPP_ERROR(LOGGER,
"Exception while creating constraint sampling plugin loader %s", ex.what());
69 boost::char_separator<char> sep(
" ");
71 for (boost::tokenizer<boost::char_separator<char>>::iterator beg = tok.begin(); beg != tok.end(); ++beg)
75 constraint_samplers::ConstraintSamplerAllocatorPtr csa =
76 constraint_sampler_plugin_loader_->createUniqueInstance(*beg);
77 csm->registerSamplerAllocator(csa);
78 RCLCPP_INFO(LOGGER,
"Loaded constraint sampling plugin %s", std::string(*beg).c_str());
80 catch (pluginlib::PluginlibException& ex)
82 RCLCPP_ERROR(LOGGER,
"Exception while planning adapter plugin '%s': %s", std::string(*beg).c_str(), ex.what());
89 const rclcpp::Node::SharedPtr node_;
90 std::unique_ptr<pluginlib::ClassLoader<constraint_samplers::ConstraintSamplerAllocator>>
91 constraint_sampler_plugin_loader_;
94 const rclcpp::Node::SharedPtr& node,
const constraint_samplers::ConstraintSamplerManagerPtr& csm)
95 : constraint_sampler_manager_(csm ? csm : std::make_shared<
constraint_samplers::ConstraintSamplerManager>())
96 , impl_(std::make_shared<
Helper>(node, constraint_sampler_manager_))
Helper(const rclcpp::Node::SharedPtr &node, const constraint_samplers::ConstraintSamplerManagerPtr &csm)
ConstraintSamplerManagerLoader(const rclcpp::Node::SharedPtr &node, const constraint_samplers::ConstraintSamplerManagerPtr &csm=constraint_samplers::ConstraintSamplerManagerPtr())
The constraint samplers namespace contains a number of methods for generating samples based on a cons...
const rclcpp::Logger LOGGER