52 ROS_ERROR(
"Unable to construct colllision plugin loader. Error: %s", e.what());
56 CollisionPluginPtr
load(
const std::string& name)
58 CollisionPluginPtr plugin;
61 plugin.reset(
loader_->createUnmanagedInstance(name));
71 bool activate(
const std::string& name,
const planning_scene::PlanningScenePtr& scene,
bool exclusive)
73 std::map<std::string, CollisionPluginPtr>::iterator it =
plugins_.find(name);
76 CollisionPluginPtr plugin =
load(name);
79 return plugin->initialize(scene, exclusive);
85 return it->second->initialize(scene, exclusive);
91 std::shared_ptr<pluginlib::ClassLoader<CollisionPlugin> >
loader_;
92 std::map<std::string, CollisionPluginPtr>
plugins_;
107 return loader_->activate(name, scene, exclusive);
115 std::string param_name;
116 std::string collision_detector_name;
118 if (nh.
searchParam(
"collision_detector", param_name))
120 nh.
getParam(param_name, collision_detector_name);
122 else if (nh.
hasParam(
"/move_group/collision_detector"))
126 nh.
getParam(
"/move_group/collision_detector", collision_detector_name);
133 if (collision_detector_name ==
"")
139 activate(collision_detector_name, scene,
true);
140 ROS_INFO_STREAM(
"Using collision detector:" << scene->getActiveCollisionDetectorName().c_str());
std::shared_ptr< pluginlib::ClassLoader< CollisionPlugin > > loader_
bool activate(const std::string &name, const planning_scene::PlanningScenePtr &scene, bool exclusive)
Load a collision detection robot/world into a planning scene instance.
std::map< std::string, CollisionPluginPtr > plugins_
CollisionPluginLoaderImpl()
void setupScene(ros::NodeHandle &nh, const planning_scene::PlanningScenePtr &scene)
This can be called on a new planning scene to setup the collision detector.
CollisionPluginPtr load(const std::string &name)
bool searchParam(const std::string &key, std::string &result) const
bool activate(const std::string &name, const planning_scene::PlanningScenePtr &scene, bool exclusive)
#define ROS_INFO_STREAM(args)
bool getParam(const std::string &key, std::string &s) const
bool hasParam(const std::string &key) const
#define ROS_ERROR_STREAM(args)