37 #include <boost/algorithm/string.hpp> 72 if (Transforms::isFixedFrame(frame))
80 const Eigen::Affine3d&
getTransform(
const std::string& from_frame)
const override 90 collision_detection::World::ObjectConstPtr obj =
scene_->
getWorld()->getObject(
id);
91 return obj->shape_poses_.size() == 1;
101 return msg.name.empty() && msg.fixed_frame_transforms.empty() && msg.allowed_collision_matrix.entry_names.empty() &&
102 msg.link_padding.empty() && msg.link_scale.empty() &&
isEmpty(msg.robot_state) &&
isEmpty(msg.world);
110 return static_cast<bool>(msg.is_diff) && msg.multi_dof_joint_state.joint_names.empty() &&
111 msg.joint_state.name.empty() && msg.attached_collision_objects.empty() && msg.joint_state.position.empty() &&
112 msg.joint_state.velocity.empty() && msg.joint_state.effort.empty() &&
113 msg.multi_dof_joint_state.transforms.empty() && msg.multi_dof_joint_state.twist.empty() &&
114 msg.multi_dof_joint_state.wrench.empty();
119 return msg.collision_objects.empty() && msg.octomap.octomap.data.empty();
123 : kmodel_(robot_model), world_(world), world_const_(world)
162 const std::vector<std::string>& collision_links =
kmodel_->getLinkModelNamesWithCollisionGeometry();
163 acm_->setEntry(collision_links, collision_links,
false);
166 const std::vector<srdf::Model::DisabledCollision>& dc =
getRobotModel()->getSRDF()->getDisabledCollisionPairs();
167 for (std::vector<srdf::Model::DisabledCollision>::const_iterator it = dc.begin(); it != dc.end(); ++it)
168 acm_->setEntry(it->link1_, it->link2_,
true);
178 if (!robot_model || !robot_model->getRootJoint())
179 return robot_model::RobotModelPtr();
189 if (!
parent_->getName().empty())
205 const CollisionDetectorPtr& parent_detector = it->second;
206 CollisionDetectorPtr& detector =
collision_[it->first];
208 detector->alloc_ = parent_detector->alloc_;
209 detector->parent_ = parent_detector;
211 detector->cworld_ = detector->alloc_->allocateWorld(parent_detector->cworld_,
world_);
212 detector->cworld_const_ = detector->cworld_;
216 detector->crobot_.reset();
217 detector->crobot_const_.reset();
218 detector->crobot_unpadded_.reset();
219 detector->crobot_unpadded_const_.reset();
226 PlanningScenePtr result = scene->diff();
227 result->decoupleParent();
228 result->setName(scene->getName());
234 return PlanningScenePtr(
new PlanningScene(shared_from_this()));
239 PlanningScenePtr result =
diff();
240 result->setPlanningSceneDiffMsg(msg);
248 alloc_->allocateRobot(
parent_->getCollisionRobot());
249 crobot_const_ = crobot_;
274 if (it != scene.
parent_->collision_.end())
280 const std::string& name = allocator->getName();
281 CollisionDetectorPtr& detector =
collision_[name];
288 detector->alloc_ = allocator;
293 detector->findParent(*
this);
295 detector->cworld_ = detector->alloc_->allocateWorld(
world_);
296 detector->cworld_const_ = detector->cworld_;
302 detector->crobot_ = detector->alloc_->allocateRobot(
getRobotModel());
303 detector->crobot_const_ = detector->crobot_;
310 if (!detector->parent_)
312 detector->crobot_unpadded_ = detector->alloc_->allocateRobot(
getRobotModel());
313 detector->crobot_unpadded_const_ = detector->crobot_unpadded_;
322 CollisionDetectorPtr p;
353 "Cannot setActiveCollisionDetector to '%s' -- it has been added to PlanningScene. " 354 "Keeping existing active collision detector '%s'",
365 names.push_back(it->first);
368 const collision_detection::CollisionWorldConstPtr&
375 "Could not get CollisionWorld named '%s'. Returning active CollisionWorld '%s' instead",
380 return it->second->cworld_const_;
383 const collision_detection::CollisionRobotConstPtr&
390 "Could not get CollisionRobot named '%s'. Returning active CollisionRobot '%s' instead",
395 return it->second->getCollisionRobot();
398 const collision_detection::CollisionRobotConstPtr&
404 ROS_ERROR_NAMED(
"planning_scene",
"Could not get CollisionRobotUnpadded named '%s'. " 405 "Returning active CollisionRobotUnpadded '%s' instead",
410 return it->second->getCollisionRobotUnpadded();
428 if (!it->second->parent_)
429 it->second->findParent(*
this);
431 if (it->second->parent_)
433 it->second->crobot_.reset();
434 it->second->crobot_const_.reset();
435 it->second->crobot_unpadded_.reset();
436 it->second->crobot_unpadded_const_.reset();
438 it->second->cworld_ = it->second->alloc_->allocateWorld(it->second->parent_->cworld_,
world_);
439 it->second->cworld_const_ = it->second->cworld_;
443 it->second->copyPadding(*
parent_->active_collision_);
445 it->second->cworld_ = it->second->alloc_->allocateWorld(
world_);
446 it->second->cworld_const_ = it->second->cworld_;
463 scene->getTransformsNonConst().setAllTransforms(
ftf_->getAllTransforms());
467 scene->getCurrentStateNonConst() = *
kstate_;
469 std::vector<const moveit::core::AttachedBody*> attached_objs;
470 kstate_->getAttachedBodies(attached_objs);
471 for (std::vector<const moveit::core::AttachedBody*>::const_iterator it = attached_objs.begin();
472 it != attached_objs.end(); ++it)
475 scene->setObjectType((*it)->getName(),
getObjectType((*it)->getName()));
477 scene->setObjectColor((*it)->getName(),
getObjectColor((*it)->getName()));
482 scene->getAllowedCollisionMatrixNonConst() = *
acm_;
486 collision_detection::CollisionRobotPtr active_crobot = scene->getCollisionRobotNonConst();
489 scene->propogateRobotPadding();
498 scene->world_->removeObject(it->first);
499 scene->removeObjectColor(it->first);
500 scene->removeObjectType(it->first);
505 scene->world_->removeObject(obj.
id_);
619 for (collision_detection::CollisionResult::ContactMap::const_iterator it = contacts.begin(); it != contacts.end();
621 for (std::size_t j = 0; j < it->second.size(); ++j)
624 links.push_back(it->second[j].body_name_1);
626 links.push_back(it->second[j].body_name_2);
663 kstate_->setAttachedBodyUpdateCallback(callback);
694 ftf_->setAllTransforms(
parent_->getTransforms().getAllTransforms());
701 scene_msg.name =
name_;
703 scene_msg.is_diff =
true;
706 ftf_->copyTransforms(scene_msg.fixed_frame_transforms);
708 scene_msg.fixed_frame_transforms.clear();
714 scene_msg.robot_state = moveit_msgs::RobotState();
715 scene_msg.robot_state.is_diff =
true;
719 acm_->getMessage(scene_msg.allowed_collision_matrix);
721 scene_msg.allowed_collision_matrix = moveit_msgs::AllowedCollisionMatrix();
730 scene_msg.link_padding.clear();
731 scene_msg.link_scale.clear();
734 scene_msg.object_colors.clear();
741 scene_msg.object_colors[i].id = it->first;
742 scene_msg.object_colors[i].color = it->second;
746 scene_msg.world.collision_objects.clear();
747 scene_msg.world.octomap = octomap_msgs::OctomapWithPose();
751 bool do_omap =
false;
758 moveit_msgs::CollisionObject co;
761 co.operation = moveit_msgs::CollisionObject::REMOVE;
762 scene_msg.world.collision_objects.push_back(co);
766 scene_msg.world.collision_objects.emplace_back();
777 class ShapeVisitorAddToCollisionObject :
public boost::static_visitor<void>
780 ShapeVisitorAddToCollisionObject(moveit_msgs::CollisionObject* obj) : boost::static_visitor<void>(),
obj_(obj)
784 void setPoseMessage(
const geometry_msgs::Pose* pose)
789 void operator()(
const shape_msgs::Plane& shape_msg)
const 791 obj_->planes.push_back(shape_msg);
795 void operator()(
const shape_msgs::Mesh& shape_msg)
const 797 obj_->meshes.push_back(shape_msg);
801 void operator()(
const shape_msgs::SolidPrimitive& shape_msg)
const 803 obj_->primitives.push_back(shape_msg);
808 moveit_msgs::CollisionObject*
obj_;
816 collision_obj.id = ns;
817 collision_obj.operation = moveit_msgs::CollisionObject::ADD;
821 ShapeVisitorAddToCollisionObject sv(&collision_obj);
822 for (std::size_t j = 0; j < obj->shapes_.size(); ++j)
827 geometry_msgs::Pose p;
830 sv.setPoseMessage(&p);
831 boost::apply_visitor(sv, sm);
835 if (!collision_obj.primitives.empty() || !collision_obj.meshes.empty() || !collision_obj.planes.empty())
845 collision_objs.clear();
846 const std::vector<std::string>& ns =
world_->getObjectIds();
847 for (std::size_t i = 0; i < ns.size(); ++i)
850 collision_objs.emplace_back();
856 const std::string& ns)
const 858 std::vector<moveit_msgs::AttachedCollisionObject> attached_collision_objs;
860 for (std::size_t i = 0; i < attached_collision_objs.size(); ++i)
862 if (attached_collision_objs[i].
object.
id == ns)
864 attached_collision_obj = attached_collision_objs[i];
872 std::vector<moveit_msgs::AttachedCollisionObject>& attached_collision_objs)
const 874 std::vector<const moveit::core::AttachedBody*> attached_bodies;
882 octomap.octomap = octomap_msgs::Octomap();
887 if (map->shapes_.size() == 1)
895 "Unexpected number of shapes in octomap collision object. Not including '%s' object",
903 object_colors.clear();
908 object_colors.resize(cmap.size());
909 for (ObjectColorMap::const_iterator it = cmap.begin(); it != cmap.end(); ++it, ++i)
911 object_colors[i].id = it->first;
912 object_colors[i].color = it->second;
918 scene_msg.name =
name_;
919 scene_msg.is_diff =
false;
938 const moveit_msgs::PlanningSceneComponents& comp)
const 940 scene_msg.is_diff =
false;
941 if (comp.components & moveit_msgs::PlanningSceneComponents::SCENE_SETTINGS)
943 scene_msg.name =
name_;
947 if (comp.components & moveit_msgs::PlanningSceneComponents::TRANSFORMS)
950 if (comp.components & moveit_msgs::PlanningSceneComponents::ROBOT_STATE_ATTACHED_OBJECTS)
953 for (std::vector<moveit_msgs::AttachedCollisionObject>::iterator it =
954 scene_msg.robot_state.attached_collision_objects.begin();
955 it != scene_msg.robot_state.attached_collision_objects.end(); ++it)
963 else if (comp.components & moveit_msgs::PlanningSceneComponents::ROBOT_STATE)
968 if (comp.components & moveit_msgs::PlanningSceneComponents::ALLOWED_COLLISION_MATRIX)
971 if (comp.components & moveit_msgs::PlanningSceneComponents::LINK_PADDING_AND_SCALING)
977 if (comp.components & moveit_msgs::PlanningSceneComponents::OBJECT_COLORS)
981 if (comp.components & moveit_msgs::PlanningSceneComponents::WORLD_OBJECT_GEOMETRY)
983 else if (comp.components & moveit_msgs::PlanningSceneComponents::WORLD_OBJECT_NAMES)
985 const std::vector<std::string>& ns =
world_->getObjectIds();
986 scene_msg.world.collision_objects.clear();
987 scene_msg.world.collision_objects.reserve(ns.size());
988 for (std::size_t i = 0; i < ns.size(); ++i)
991 moveit_msgs::CollisionObject co;
995 scene_msg.world.collision_objects.push_back(co);
1000 if (comp.components & moveit_msgs::PlanningSceneComponents::OCTOMAP)
1006 out <<
name_ << std::endl;
1007 const std::vector<std::string>& ns =
world_->getObjectIds();
1008 for (std::size_t i = 0; i < ns.size(); ++i)
1014 out <<
"* " << ns[i] << std::endl;
1015 out << obj->shapes_.size() << std::endl;
1016 for (std::size_t j = 0; j < obj->shapes_.size(); ++j)
1019 out << obj->shape_poses_[j].translation().x() <<
" " << obj->shape_poses_[j].translation().y() <<
" " 1020 << obj->shape_poses_[j].translation().z() << std::endl;
1021 Eigen::Quaterniond
r(obj->shape_poses_[j].linear());
1022 out <<
r.x() <<
" " <<
r.y() <<
" " <<
r.z() <<
" " <<
r.w() << std::endl;
1026 out << c.r <<
" " << c.g <<
" " << c.b <<
" " << c.a << std::endl;
1029 out <<
"0 0 0 0" << std::endl;
1033 out <<
"." << std::endl;
1043 if (!in.good() || in.eof())
1045 std::getline(in,
name_);
1050 if (!in.good() || in.eof())
1055 std::getline(in, ns);
1056 if (!in.good() || in.eof())
1058 boost::algorithm::trim(ns);
1059 unsigned int shape_count;
1061 for (std::size_t i = 0; i < shape_count && in.good() && !in.eof(); ++i)
1064 double x,
y,
z, rx, ry, rz, rw;
1066 in >> rx >> ry >> rz >> rw;
1068 in >> r >> g >> b >> a;
1071 Eigen::Affine3d pose = Eigen::Translation3d(x, y, z) * Eigen::Quaterniond(rw, rx, ry, rz);
1073 pose = offset * pose;
1075 if (r > 0.0
f || g > 0.0
f || b > 0.0
f || a > 0.0
f)
1077 std_msgs::ColorRGBA color;
1096 moveit_msgs::RobotState state_no_attached(state);
1097 state_no_attached.attached_collision_objects.clear();
1111 for (std::size_t i = 0; i < state.attached_collision_objects.size(); ++i)
1113 if (!state.is_diff && state.attached_collision_objects[i].object.operation != moveit_msgs::CollisionObject::ADD)
1115 ROS_ERROR_NAMED(
"planning_scene",
"The specified RobotState is not marked as is_diff. " 1116 "The request to modify the object '%s' is not supported. Object is ignored.",
1117 state.attached_collision_objects[i].object.id.c_str());
1137 ftf_->setAllTransforms(
parent_->getTransforms().getAllTransforms());
1151 if (!it->second->crobot_)
1153 it->second->crobot_ = it->second->alloc_->allocateRobot(it->second->parent_->getCollisionRobot());
1154 it->second->crobot_const_ = it->second->crobot_;
1156 if (!it->second->crobot_unpadded_)
1158 it->second->crobot_unpadded_ =
1159 it->second->alloc_->allocateRobot(it->second->parent_->getCollisionRobotUnpadded());
1160 it->second->crobot_unpadded_const_ = it->second->crobot_unpadded_;
1162 it->second->parent_.reset();
1169 parent_->getKnownObjectColors(kc);
1175 parent_->getKnownObjectColors(kc);
1176 for (ObjectColorMap::const_iterator it = kc.begin(); it != kc.end(); ++it)
1184 parent_->getKnownObjectTypes(kc);
1190 parent_->getKnownObjectTypes(kc);
1191 for (ObjectTypeMap::const_iterator it = kc.begin(); it != kc.end(); ++it)
1204 if (!scene_msg.name.empty())
1205 name_ = scene_msg.name;
1207 if (!scene_msg.robot_model_name.empty() && scene_msg.robot_model_name !=
getRobotModel()->getName())
1208 ROS_WARN_NAMED(
"planning_scene",
"Setting the scene for model '%s' but model '%s' is loaded.",
1209 scene_msg.robot_model_name.c_str(),
getRobotModel()->getName().c_str());
1213 if (!scene_msg.fixed_frame_transforms.empty())
1217 ftf_->setTransforms(scene_msg.fixed_frame_transforms);
1221 if (!scene_msg.robot_state.multi_dof_joint_state.joint_names.empty() ||
1222 !scene_msg.robot_state.joint_state.name.empty() || !scene_msg.robot_state.attached_collision_objects.empty())
1226 if (!scene_msg.allowed_collision_matrix.entry_names.empty())
1229 if (!scene_msg.link_padding.empty() || !scene_msg.link_scale.empty())
1233 if (!it->second->crobot_)
1235 it->second->crobot_ = it->second->alloc_->allocateRobot(it->second->parent_->getCollisionRobot());
1236 it->second->crobot_const_ = it->second->crobot_;
1238 it->second->crobot_->setPadding(scene_msg.link_padding);
1239 it->second->crobot_->setScale(scene_msg.link_scale);
1244 for (std::size_t i = 0; i < scene_msg.object_colors.size(); ++i)
1245 setObjectColor(scene_msg.object_colors[i].id, scene_msg.object_colors[i].color);
1248 for (std::size_t i = 0; i < scene_msg.world.collision_objects.size(); ++i)
1252 if (!scene_msg.world.octomap.octomap.data.empty())
1260 ROS_DEBUG_NAMED(
"planning_scene",
"Setting new planning scene: '%s'", scene_msg.name.c_str());
1261 name_ = scene_msg.name;
1263 if (!scene_msg.robot_model_name.empty() && scene_msg.robot_model_name !=
getRobotModel()->getName())
1264 ROS_WARN_NAMED(
"planning_scene",
"Setting the scene for model '%s' but model '%s' is loaded.",
1265 scene_msg.robot_model_name.c_str(),
getRobotModel()->getName().c_str());
1271 ftf_->setTransforms(scene_msg.fixed_frame_transforms);
1276 if (!it->second->crobot_)
1278 it->second->crobot_ = it->second->alloc_->allocateRobot(it->second->parent_->getCollisionRobot());
1279 it->second->crobot_const_ = it->second->crobot_;
1281 it->second->crobot_->setPadding(scene_msg.link_padding);
1282 it->second->crobot_->setScale(scene_msg.link_scale);
1285 for (std::size_t i = 0; i < scene_msg.object_colors.size(); ++i)
1286 setObjectColor(scene_msg.object_colors[i].id, scene_msg.object_colors[i].color);
1294 for (std::size_t i = 0; i < world.collision_objects.size(); ++i)
1302 if (scene_msg.is_diff)
1313 if (map.data.empty())
1316 if (map.id !=
"OcTree")
1318 ROS_ERROR_NAMED(
"planning_scene",
"Received octomap is of type '%s' but type 'OcTree' is expected.",
1324 if (!map.header.frame_id.empty())
1337 const std::vector<std::string>& object_ids =
world_->getObjectIds();
1338 for (std::size_t i = 0; i < object_ids.size(); ++i)
1341 world_->removeObject(object_ids[i]);
1352 if (map.octomap.data.empty())
1355 if (map.octomap.id !=
"OcTree")
1357 ROS_ERROR_NAMED(
"planning_scene",
"Received octomap is of type '%s' but type 'OcTree' is expected.",
1358 map.octomap.id.c_str());
1375 if (map->shapes_.size() == 1)
1382 if (map->shape_poses_[0].isApprox(t, std::numeric_limits<double>::epsilon() * 100.0))
1405 if (
object.
object.operation == moveit_msgs::CollisionObject::ADD && !
getRobotModel()->hasLinkModel(
object.link_name))
1407 ROS_ERROR_NAMED(
"planning_scene",
"Unable to attach a body to link '%s' (link not found)",
1408 object.link_name.c_str());
1414 ROS_ERROR_NAMED(
"planning_scene",
"The ID '%s' cannot be used for collision objects (name reserved)",
1426 if (
object.
object.operation == moveit_msgs::CollisionObject::ADD ||
1427 object.
object.operation == moveit_msgs::CollisionObject::APPEND)
1429 if (
object.
object.primitives.size() !=
object.object.primitive_poses.size())
1431 ROS_ERROR_NAMED(
"planning_scene",
"Number of primitive shapes does not match number of poses " 1432 "in attached collision object message");
1436 if (
object.
object.meshes.size() !=
object.object.mesh_poses.size())
1438 ROS_ERROR_NAMED(
"planning_scene",
"Number of meshes does not match number of poses " 1439 "in attached collision object message");
1443 if (
object.
object.planes.size() !=
object.object.plane_poses.size())
1445 ROS_ERROR_NAMED(
"planning_scene",
"Number of planes does not match number of poses " 1446 "in attached collision object message");
1453 std::vector<shapes::ShapeConstPtr>
shapes;
1457 if (
object.
object.operation == moveit_msgs::CollisionObject::ADD &&
object.
object.primitives.empty() &&
1458 object.object.meshes.empty() &&
object.object.planes.empty())
1463 ROS_DEBUG_NAMED(
"planning_scene",
"Attaching world object '%s' to link '%s'",
object.
object.
id.c_str(),
1464 object.link_name.c_str());
1467 shapes = obj->shapes_;
1468 poses = obj->shape_poses_;
1470 world_->removeObject(
object.
object.
id);
1473 const Eigen::Affine3d& i_t =
kstate_->getGlobalLinkTransform(lm).inverse(Eigen::Isometry);
1474 for (std::size_t i = 0; i < poses.size(); ++i)
1475 poses[i] = i_t * poses[i];
1479 ROS_ERROR_NAMED(
"planning_scene",
"Attempting to attach object '%s' to link '%s' but no geometry specified " 1480 "and such an object does not exist in the collision world",
1481 object.
object.
id.c_str(),
object.link_name.c_str());
1488 if (
world_->removeObject(
object.object.id))
1490 if (
object.
object.operation == moveit_msgs::CollisionObject::ADD)
1491 ROS_DEBUG_NAMED(
"planning_scene",
"Removing world object with the same name as newly attached object: '%s'",
1492 object.
object.
id.c_str());
1495 "You tried to append geometry to an attached object that is actually a world object ('%s'). " 1496 "World geometry is ignored.",
1497 object.
object.
id.c_str());
1500 for (std::size_t i = 0; i <
object.object.primitives.size(); ++i)
1511 for (std::size_t i = 0; i <
object.object.meshes.size(); ++i)
1522 for (std::size_t i = 0; i <
object.object.planes.size(); ++i)
1535 if (
object.
object.
header.frame_id !=
object.link_name)
1537 const Eigen::Affine3d& t =
kstate_->getGlobalLinkTransform(lm).inverse(Eigen::Isometry) *
1539 for (std::size_t i = 0; i < poses.size(); ++i)
1540 poses[i] = t * poses[i];
1546 ROS_ERROR_NAMED(
"planning_scene",
"There is no geometry to attach to link '%s' as part of attached body '%s'",
1547 object.link_name.c_str(),
object.object.id.c_str());
1551 if (!
object.
object.type.db.empty() || !
object.object.type.key.empty())
1554 if (
object.
object.operation == moveit_msgs::CollisionObject::ADD || !
kstate_->hasAttachedBody(
object.object.id))
1557 if (
kstate_->clearAttachedBody(
object.object.id))
1558 ROS_DEBUG_NAMED(
"planning_scene",
"The robot state already had an object named '%s' attached to link '%s'. " 1559 "The object was replaced.",
1560 object.
object.
id.c_str(),
object.link_name.c_str());
1561 kstate_->attachBody(
object.
object.
id, shapes, poses,
object.touch_links,
object.link_name,
1562 object.detach_posture);
1563 ROS_DEBUG_NAMED(
"planning_scene",
"Attached object '%s' to link '%s'",
object.
object.
id.c_str(),
1564 object.link_name.c_str());
1571 trajectory_msgs::JointTrajectory detach_posture =
1572 object.detach_posture.joint_names.empty() ? ab->
getDetachPosture() :
object.detach_posture;
1574 kstate_->clearAttachedBody(
object.
object.
id);
1575 if (
object.touch_links.empty())
1576 kstate_->attachBody(
object.object.id, shapes, poses, ab_touch_links,
object.link_name, detach_posture);
1578 kstate_->attachBody(
object.
object.
id, shapes, poses,
object.touch_links,
object.link_name, detach_posture);
1579 ROS_DEBUG_NAMED(
"planning_scene",
"Added shapes to object '%s' attached to link '%s'",
object.
object.
id.c_str(),
1580 object.link_name.c_str());
1586 ROS_ERROR_NAMED(
"planning_scene",
"Robot state is not compatible with robot model. This could be fatal.");
1588 else if (
object.
object.operation == moveit_msgs::CollisionObject::REMOVE)
1590 std::vector<const robot_state::AttachedBody*> attached_bodies;
1591 if (
object.link_name.empty())
1593 if (
object.
object.
id.empty())
1594 kstate_->getAttachedBodies(attached_bodies);
1599 attached_bodies.push_back(ab);
1607 if (
object.
object.
id.empty())
1610 kstate_->getAttachedBodies(attached_bodies, lm);
1616 attached_bodies.push_back(ab);
1621 for (std::size_t i = 0; i < attached_bodies.size(); ++i)
1623 std::vector<shapes::ShapeConstPtr>
shapes = attached_bodies[i]->getShapes();
1625 std::string name = attached_bodies[i]->getName();
1627 kstate_->clearAttachedBody(name);
1629 if (
world_->hasObject(name))
1631 "The collision world already has an object with the same name as the body about to be detached. " 1632 "NOT adding the detached body '%s' to the collision world.",
1633 object.
object.
id.c_str());
1636 world_->addToObject(name, shapes, poses);
1638 "Detached object '%s' from link '%s' and added it back in the collision world", name.c_str(),
1639 object.link_name.c_str());
1642 if (!attached_bodies.empty() ||
object.object.id.empty())
1645 else if (
object.
object.operation == moveit_msgs::CollisionObject::MOVE)
1647 ROS_ERROR_NAMED(
"planning_scene",
"Move for attached objects not yet implemented");
1651 ROS_ERROR_NAMED(
"planning_scene",
"Unknown collision object operation: %d",
object.
object.operation);
1661 ROS_ERROR_NAMED(
"planning_scene",
"The ID '%s' cannot be used for collision objects (name reserved)",
1666 if (
object.operation == moveit_msgs::CollisionObject::ADD ||
object.operation == moveit_msgs::CollisionObject::APPEND)
1668 if (
object.primitives.empty() &&
object.meshes.empty() &&
object.planes.empty())
1670 ROS_ERROR_NAMED(
"planning_scene",
"There are no shapes specified in the collision object message");
1674 if (
object.primitives.size() !=
object.primitive_poses.size())
1676 ROS_ERROR_NAMED(
"planning_scene",
"Number of primitive shapes does not match number of poses " 1677 "in collision object message");
1681 if (
object.meshes.size() !=
object.mesh_poses.size())
1683 ROS_ERROR_NAMED(
"planning_scene",
"Number of meshes does not match number of poses in collision object message");
1687 if (
object.planes.size() !=
object.plane_poses.size())
1689 ROS_ERROR_NAMED(
"planning_scene",
"Number of planes does not match number of poses in collision object message");
1694 if (
object.operation == moveit_msgs::CollisionObject::ADD &&
world_->hasObject(
object.id))
1695 world_->removeObject(
object.id);
1699 for (std::size_t i = 0; i <
object.primitives.size(); ++i)
1709 for (std::size_t i = 0; i <
object.meshes.size(); ++i)
1719 for (std::size_t i = 0; i <
object.planes.size(); ++i)
1729 if (!
object.type.key.empty() || !
object.type.db.empty())
1733 else if (
object.operation == moveit_msgs::CollisionObject::REMOVE)
1735 if (
object.
id.empty())
1741 world_->removeObject(
object.
id);
1747 else if (
object.operation == moveit_msgs::CollisionObject::MOVE)
1749 if (
world_->hasObject(
object.id))
1751 if (!
object.primitives.empty() || !
object.meshes.empty() || !
object.planes.empty())
1753 "Move operation for object '%s' ignores the geometry specified in the message.",
1758 for (std::size_t i = 0; i <
object.primitive_poses.size(); ++i)
1762 new_poses.push_back(t * p);
1764 for (std::size_t i = 0; i <
object.mesh_poses.size(); ++i)
1768 new_poses.push_back(t * p);
1770 for (std::size_t i = 0; i <
object.plane_poses.size(); ++i)
1774 new_poses.push_back(t * p);
1777 collision_detection::World::ObjectConstPtr obj =
world_->getObject(
object.
id);
1778 if (obj->shapes_.size() == new_poses.size())
1780 std::vector<shapes::ShapeConstPtr>
shapes = obj->shapes_;
1782 world_->removeObject(
object.
id);
1783 world_->addToObject(
object.
id, shapes, new_poses);
1788 "Number of supplied poses (%zu) for object '%s' does not match number of shapes (%zu). " 1790 new_poses.size(),
object.id.c_str(), obj->shapes_.size());
1796 ROS_ERROR_NAMED(
"planning_scene",
"World object '%s' does not exist. Cannot move.",
object.
id.c_str());
1799 ROS_ERROR_NAMED(
"planning_scene",
"Unknown collision object operation: %d",
object.operation);
1817 const std::string&
id)
const 1819 if (!
id.empty() &&
id[0] ==
'/')
1825 collision_detection::World::ObjectConstPtr obj =
getWorld()->getObject(
id);
1826 if (obj->shape_poses_.size() > 1)
1828 ROS_WARN_NAMED(
"planning_scene",
"More than one shapes in object '%s'. Using first one to decide transform",
1830 return obj->shape_poses_[0];
1832 else if (obj->shape_poses_.size() == 1)
1833 return obj->shape_poses_[0];
1845 if (!
id.empty() &&
id[0] ==
'/')
1850 collision_detection::World::ObjectConstPtr obj =
getWorld()->getObject(
id);
1853 return obj->shape_poses_.size() == 1;
1864 return parent_->hasObjectType(
id);
1877 return parent_->getObjectType(
id);
1878 static const object_recognition_msgs::ObjectType empty;
1886 (*object_types_)[id] = type;
1899 parent_->getKnownObjectTypes(kc);
1902 kc[it->first] = it->second;
1911 return parent_->hasObjectColor(
id);
1924 return parent_->getObjectColor(
id);
1925 static const std_msgs::ColorRGBA empty;
1933 parent_->getKnownObjectColors(kc);
1936 kc[it->first] = it->second;
1943 ROS_ERROR_NAMED(
"planning_scene",
"Cannot set color of object with empty id.");
1948 (*object_colors_)[id] = color;
2011 kinematic_constraints::KinematicConstraintSetPtr ks(
2036 static const moveit_msgs::Constraints emp_constraints;
2037 return isStateValid(state, emp_constraints, group, verbose);
2042 static const moveit_msgs::Constraints emp_constraints;
2043 return isStateValid(state, emp_constraints, group, verbose);
2047 const std::string& group,
bool verbose)
const 2055 const std::string& group,
bool verbose)
const 2076 const moveit_msgs::RobotTrajectory&
trajectory,
const std::string& group,
bool verbose,
2077 std::vector<std::size_t>* invalid_index)
const 2079 static const moveit_msgs::Constraints emp_constraints;
2080 static const std::vector<moveit_msgs::Constraints> emp_constraints_vector;
2081 return isPathValid(start_state, trajectory, emp_constraints, emp_constraints_vector, group, verbose, invalid_index);
2085 const moveit_msgs::RobotTrajectory&
trajectory,
2086 const moveit_msgs::Constraints& path_constraints,
const std::string& group,
2087 bool verbose, std::vector<std::size_t>* invalid_index)
const 2089 static const std::vector<moveit_msgs::Constraints> emp_constraints_vector;
2090 return isPathValid(start_state, trajectory, path_constraints, emp_constraints_vector, group, verbose, invalid_index);
2094 const moveit_msgs::RobotTrajectory&
trajectory,
2095 const moveit_msgs::Constraints& path_constraints,
2096 const moveit_msgs::Constraints& goal_constraints,
const std::string& group,
2097 bool verbose, std::vector<std::size_t>* invalid_index)
const 2099 std::vector<moveit_msgs::Constraints> goal_constraints_vector(1, goal_constraints);
2100 return isPathValid(start_state, trajectory, path_constraints, goal_constraints_vector, group, verbose, invalid_index);
2104 const moveit_msgs::RobotTrajectory&
trajectory,
2105 const moveit_msgs::Constraints& path_constraints,
2106 const std::vector<moveit_msgs::Constraints>& goal_constraints,
const std::string& group,
2107 bool verbose, std::vector<std::size_t>* invalid_index)
const 2113 return isPathValid(t, path_constraints, goal_constraints, group, verbose, invalid_index);
2117 const moveit_msgs::Constraints& path_constraints,
2118 const std::vector<moveit_msgs::Constraints>& goal_constraints,
const std::string& group,
2119 bool verbose, std::vector<std::size_t>* invalid_index)
const 2123 invalid_index->clear();
2127 for (std::size_t i = 0; i < n_wp; ++i)
2131 bool this_state_valid =
true;
2133 this_state_valid =
false;
2135 this_state_valid =
false;
2137 this_state_valid =
false;
2139 if (!this_state_valid)
2142 invalid_index->push_back(i);
2149 if (i + 1 == n_wp && !goal_constraints.empty())
2152 for (std::size_t k = 0; k < goal_constraints.size(); ++k)
2165 invalid_index->push_back(i);
2174 const moveit_msgs::Constraints& path_constraints,
2175 const moveit_msgs::Constraints& goal_constraints,
const std::string& group,
2176 bool verbose, std::vector<std::size_t>* invalid_index)
const 2178 std::vector<moveit_msgs::Constraints> goal_constraints_vector(1, goal_constraints);
2179 return isPathValid(trajectory, path_constraints, goal_constraints_vector, group, verbose, invalid_index);
2183 const moveit_msgs::Constraints& path_constraints,
const std::string& group,
2184 bool verbose, std::vector<std::size_t>* invalid_index)
const 2186 static const std::vector<moveit_msgs::Constraints> emp_constraints_vector;
2187 return isPathValid(trajectory, path_constraints, emp_constraints_vector, group, verbose, invalid_index);
2191 bool verbose, std::vector<std::size_t>* invalid_index)
const 2193 static const moveit_msgs::Constraints emp_constraints;
2194 static const std::vector<moveit_msgs::Constraints> emp_constraints_vector;
2195 return isPathValid(trajectory, emp_constraints, emp_constraints_vector, group, verbose, invalid_index);
2199 std::set<collision_detection::CostSource>& costs,
double overlap_fraction)
const 2201 getCostSources(trajectory, max_costs, std::string(), costs, overlap_fraction);
2205 const std::string& group_name, std::set<collision_detection::CostSource>& costs,
2206 double overlap_fraction)
const 2212 std::set<collision_detection::CostSource> cs;
2213 std::set<collision_detection::CostSource> cs_start;
2215 for (std::size_t i = 0; i < n_wp; ++i)
2224 if (cs.size() <= max_costs)
2230 for (std::set<collision_detection::CostSource>::iterator it = cs.begin(); i < max_costs; ++it, ++i)
2239 std::set<collision_detection::CostSource>& costs)
const 2245 const std::string& group_name,
2246 std::set<collision_detection::CostSource>& costs)
const 2259 const std::vector<std::string>& objects =
getWorld()->getObjectIds();
2261 out <<
"Collision World Objects:\n\t ";
2262 std::copy(objects.begin(), objects.end(), std::ostream_iterator<std::string>(out,
"\n\t "));
2264 std::vector<const robot_state::AttachedBody*> attached_bodies;
2267 out <<
"\nAttached Bodies:\n";
2268 for (std::size_t i = 0; i < attached_bodies.size(); ++i)
2270 out <<
"\t " << attached_bodies[i]->getName() <<
"\n";
bool empty() const
Returns whether or not there are any constraints in the set.
bool isPathValid(const moveit_msgs::RobotState &start_state, const moveit_msgs::RobotTrajectory &trajectory, const std::string &group="", bool verbose=false, std::vector< std::size_t > *invalid_index=NULL) const
Check if a given path is valid. Each state is checked for validity (collision avoidance and feasibili...
const collision_detection::CollisionRobotConstPtr & getCollisionRobot() const
Get the active collision detector for the robot.
void getAttachedBodies(std::vector< const AttachedBody * > &attached_bodies) const
Get all bodies attached to the model corresponding to this state.
Maintain a diff list of changes that have happened to a World.
std::map< std::string, World::Action >::const_iterator const_iterator
bool knowsFrameTransform(const std::string &id) const
Check if a transform to the frame id is known. This will be known if id is a link name...
This may be thrown during construction of objects if errors occur.
Representation of a collision checking request.
Core components of MoveIt!
bool isEmpty(const moveit_msgs::Constraints &constr)
Check if any constraints were specified.
void attachedBodiesToAttachedCollisionObjectMsgs(const std::vector< const AttachedBody * > &attached_bodies, std::vector< moveit_msgs::AttachedCollisionObject > &attached_collision_objs)
Convert AttachedBodies to AttachedCollisionObjects.
bool getAttachedCollisionObjectMsg(moveit_msgs::AttachedCollisionObject &attached_collision_obj, const std::string &ns) const
Construct a message (attached_collision_object) with the attached collision object data from the plan...
robot_state::RobotState & getCurrentStateNonConst()
Get the state at which the robot is assumed to be.
robot_state::TransformsPtr ftf_
#define ROS_INFO_NAMED(name,...)
void setObjectType(const std::string &id, const object_recognition_msgs::ObjectType &type)
void decoupleParent()
Make sure that all the data maintained in this scene is local. All unmodified data is copied from the...
void processOctomapMsg(const octomap_msgs::OctomapWithPose &map)
bool hasObjectType(const std::string &id) const
std::vector< Eigen::Affine3d, Eigen::aligned_allocator< Eigen::Affine3d > > vector_Affine3d
static CollisionDetectorAllocatorPtr create()
const collision_detection::AllowedCollisionMatrix & getAllowedCollisionMatrix() const
Get the allowed collision matrix.
static bool isEmpty(const moveit_msgs::PlanningScene &msg)
Check if a message includes any information about a planning scene, or it is just a default...
#define ROS_WARN_NAMED(name,...)
void getMessage(moveit_msgs::AllowedCollisionMatrix &msg) const
Get the allowed collision matrix as a message.
bool knowsFrameTransform(const std::string &id) const
Check if a transformation matrix from the model frame to frame id is known.
bool isStateValid(const moveit_msgs::RobotState &state, const std::string &group="", bool verbose=false) const
Check if a given state is valid. This means checking for collisions and feasibility.
void removeObjectColor(const std::string &id)
robot_state::RobotStatePtr kstate_
void poseEigenToMsg(const Eigen::Affine3d &e, geometry_msgs::Pose &m)
StateFeasibilityFn state_feasibility_
PlanningScene(const robot_model::RobotModelConstPtr &robot_model, collision_detection::WorldPtr world=collision_detection::WorldPtr(new collision_detection::World()))
construct using an existing RobotModel
void poseMsgToEigen(const geometry_msgs::Pose &m, Eigen::Affine3d &e)
std::vector< shapes::ShapeConstPtr > shapes_
All the shapes making up this object.
void checkSelfCollision(const collision_detection::CollisionRequest &req, collision_detection::CollisionResult &res)
Check whether the current state is in self collision.
void getAttachedCollisionObjectMsgs(std::vector< moveit_msgs::AttachedCollisionObject > &attached_collision_objs) const
Construct a vector of messages (attached_collision_objects) with the attached collision object data f...
static const std::string DEFAULT_SCENE_NAME
Maintain a representation of the environment.
static bool fullMapToMsg(const OctomapT &octomap, Octomap &msg)
const Eigen::Affine3d & getFrameTransform(const std::string &id) const
Get the transform corresponding to the frame id. This will be known if id is a link name...
ContactMap contacts
A map returning the pairs of ids of the bodies in contact, plus information about the contacts themse...
static octomap::AbstractOcTree * msgToMap(const Octomap &msg)
bool processAttachedCollisionObjectMsg(const moveit_msgs::AttachedCollisionObject &object)
A class that contains many different constraints, and can check RobotState *versus the full set...
robot_model::RobotModelConstPtr kmodel_
bool processPlanningSceneWorldMsg(const moveit_msgs::PlanningSceneWorld &world)
const Eigen::Affine3d & getFrameTransform(const std::string &id)
Get the transformation matrix from the model frame to the frame identified by id. ...
Representation of a collision checking result.
std_msgs::Header * header(M &m)
bool getCollisionObjectMsg(moveit_msgs::CollisionObject &collision_obj, const std::string &ns) const
Construct a message (collision_object) with the collision object data from the planning_scene for the...
void removeObjectType(const std::string &id)
const collision_detection::CollisionRobotPtr & getCollisionRobotNonConst()
Get the representation of the collision robot This can be used to set padding and link scale on the a...
std::map< std::string, CollisionDetectorPtr >::const_iterator CollisionDetectorConstIterator
void setObjectColor(const std::string &id, const std_msgs::ColorRGBA &color)
static const std::string OCTOMAP_NS
bool processCollisionObjectMsg(const moveit_msgs::CollisionObject &object)
std::shared_ptr< Shape > ShapePtr
const std_msgs::ColorRGBA & getObjectColor(const std::string &id) const
void copyPadding(const CollisionDetector &src)
Definition of a kinematic model. This class is not thread safe, however multiple instances can be cre...
collision_detection::AllowedCollisionMatrixPtr acm_
static robot_model::RobotModelPtr createRobotModel(const urdf::ModelInterfaceSharedPtr &urdf_model, const srdf::ModelConstSharedPtr &srdf_model)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW std::string id_
The id for this object.
void setCollisionObjectUpdateCallback(const collision_detection::World::ObserverCallbackFn &callback)
Set the callback to be triggered when changes are made to the current scene world.
bool collision
True if collision was found, false otherwise.
void printKnownObjects(std::ostream &out) const
Outputs debug information about the planning scene contents.
collision_detection::WorldConstPtr world_const_
static PlanningScenePtr clone(const PlanningSceneConstPtr &scene)
Clone a planning scene. Even if the scene scene depends on a parent, the cloned scene will not...
std::unique_ptr< ObjectColorMap > object_colors_
std::map< std::pair< std::string, std::string >, std::vector< Contact > > ContactMap
std::set< CostSource > cost_sources
When costs are computed, the individual cost sources are.
bool add(const moveit_msgs::Constraints &c, const robot_state::Transforms &tf)
Add all known constraints.
PlanningScenePtr diff() const
Return a new child PlanningScene that uses this one as parent.
const std::vector< shapes::ShapeConstPtr > & getShapes() const
Get the shapes that make up this attached body.
boost::function< void(const ObjectConstPtr &, Action)> ObserverCallbackFn
std::map< std::string, object_recognition_msgs::ObjectType > ObjectTypeMap
A map from object names (e.g., attached bodies, collision objects) to their types.
World::ObjectConstPtr ObjectConstPtr
bool satisfied
Whether or not the constraint or constraints were satisfied.
#define ROS_DEBUG_NAMED(name,...)
std::shared_ptr< const octomap::OcTree > octree
std::unique_ptr< ObjectTypeMap > object_types_
robot_state::Transforms & getTransformsNonConst()
Get the set of fixed transforms from known frames to the planning frame.
std::size_t max_contacts
Overall maximum number of contacts to compute.
A representation of an object.
void getKnownObjectColors(ObjectColorMap &kc) const
bool verbose
Flag indicating whether information about detected collisions should be reported. ...
const EigenSTL::vector_Affine3d & getFixedTransforms() const
Get the fixed transform (the transforms to the shapes associated with this body)
void update(bool force=false)
Update all transforms.
robot_state::AttachedBodyCallback current_state_attached_body_callback_
boost::function< void(AttachedBody *body, bool attached)> AttachedBodyCallback
This class maintains the representation of the environment as seen by a planning instance. The environment geometry, the robot geometry and state are maintained.
void findParent(const PlanningScene &scene)
const robot_model::RobotModelConstPtr & getRobotModel() const
Get the kinematic model for which the planning scene is maintained.
void getCollidingLinks(std::vector< std::string > &links)
Get the names of the links that are involved in collisions for the current state. ...
Definition of a structure for the allowed collision matrix. All elements in the collision world are r...
const robot_state::Transforms & getTransforms() const
Get the set of fixed transforms from known frames to the planning frame.
robot_trajectory::RobotTrajectory trajectory(rmodel,"right_arm")
void propogateRobotPadding()
Copy scale and padding from active CollisionRobot to other CollisionRobots. This should be called aft...
std::map< std::string, std_msgs::ColorRGBA > ObjectColorMap
A map from object names (e.g., attached bodies, collision objects) to their colors.
void checkCollision(const collision_detection::CollisionRequest &req, collision_detection::CollisionResult &res)
Check whether the current state is in collision, and if needed, updates the collision transforms of t...
const std::set< std::string > & getTouchLinks() const
Get the links that the attached body is allowed to touch.
const robot_state::RobotState & getCurrentState() const
Get the state at which the robot is assumed to be.
void setAttachedBodyUpdateCallback(const robot_state::AttachedBodyCallback &callback)
Set the callback to be triggered when changes are made to the current scene state.
std::string group_name
The group name to check collisions for (optional; if empty, assume the complete robot) ...
Maintain a sequence of waypoints and the time durations between these waypoints.
void getCollidingPairs(collision_detection::CollisionResult::ContactMap &contacts)
Get the names of the links that are involved in collisions for the current state. Update the link tra...
bool robotStateMsgToRobotState(const Transforms &tf, const moveit_msgs::RobotState &robot_state, RobotState &state, bool copy_attached_bodies=true)
Convert a robot state msg (with accompanying extra transforms) to a MoveIt! robot state...
void saveAsText(const Shape *shape, std::ostream &out)
void setActiveCollisionDetector(const collision_detection::CollisionDetectorAllocatorPtr &allocator, bool exclusive=false)
Set the type of collision detector to use. Calls addCollisionDetector() to add it if it has not alrea...
bool isStateFeasible(const moveit_msgs::RobotState &state, bool verbose=false) const
Check if a given state is feasible, in accordance to the feasibility predicate specified by setStateF...
void removeOverlapping(std::set< CostSource > &cost_sources, double overlap_fraction)
bool contacts
If true, compute contacts.
bool setPlanningSceneMsg(const moveit_msgs::PlanningScene &scene)
Set this instance of a planning scene to be the same as the one serialized in the scene message...
void getObjectColorMsgs(std::vector< moveit_msgs::ObjectColor > &object_colors) const
Construct a vector of messages (object_colors) with the colors of the objects from the planning_scene...
const std::string & getPlanningFrame() const
Get the frame in which planning is performed.
const collision_detection::CollisionRobotConstPtr & getCollisionRobotUnpadded() const
Get the active collision detector for the robot.
Shape * constructShapeFromMsg(const shape_msgs::SolidPrimitive &shape_msg)
void getCostSources(const robot_trajectory::RobotTrajectory &trajectory, std::size_t max_costs, std::set< collision_detection::CostSource > &costs, double overlap_fraction=0.9) const
Get the top max_costs cost sources for a specified trajectory. The resulting costs are stored in cost...
void removeCostSources(std::set< CostSource > &cost_sources, const std::set< CostSource > &cost_sources_to_remove, double overlap_fraction)
This namespace includes the central class for representing planning contexts.
void getKnownObjectTypes(ObjectTypeMap &kc) const
collision_detection::AllowedCollisionMatrix & getAllowedCollisionMatrixNonConst()
Get the allowed collision matrix.
moveit_msgs::CollisionObject * obj_
const robot_state::RobotState & getWayPoint(std::size_t index) const
void removeAllCollisionObjects()
Clear all collision objects in planning scene.
CollisionDetectorPtr active_collision_
std::size_t getWayPointCount() const
std::size_t max_contacts_per_pair
Maximum number of contacts to compute per pair of bodies (multiple bodies may be in contact at differ...
void robotStateToRobotStateMsg(const RobotState &state, moveit_msgs::RobotState &robot_state, bool copy_attached_bodies=true)
Convert a MoveIt! robot state to a robot state message.
collision_detection::World::ObserverCallbackFn current_world_object_update_callback_
bool constructMsgFromShape(const Shape *shape, ShapeMsg &shape_msg)
void addCollisionDetector(const collision_detection::CollisionDetectorAllocatorPtr &allocator)
Add a new collision detector type.
collision_detection::WorldDiffPtr world_diff_
std::map< std::string, CollisionDetectorPtr > collision_
void pushDiffs(const PlanningScenePtr &scene)
If there is a parent specified for this scene, then the diffs with respect to that parent are applied...
const geometry_msgs::Pose * pose_
bool hasObjectColor(const std::string &id) const
const object_recognition_msgs::ObjectType & getObjectType(const std::string &id) const
std::size_t max_cost_sources
When costs are computed, this value defines how many of the top cost sources should be returned...
robot_state::RobotStatePtr getCurrentStateUpdated(const moveit_msgs::RobotState &update) const
Get a copy of the current state with components overwritten by the state message update.
bool isStateConstrained(const moveit_msgs::RobotState &state, const moveit_msgs::Constraints &constr, bool verbose=false) const
Check if a given state satisfies a set of constraints.
bool usePlanningSceneMsg(const moveit_msgs::PlanningScene &scene)
Call setPlanningSceneMsg() or setPlanningSceneDiffMsg() depending on how the is_diff member of the me...
void clearDiffs()
Clear the diffs accumulated for this planning scene, with respect to the parent. This function is a n...
collision_detection::World::ObserverHandle current_world_object_update_observer_handle_
void setCurrentState(const moveit_msgs::RobotState &state)
Set the current robot state to be state. If not all joint values are specified, the previously mainta...
void processOctomapPtr(const std::shared_ptr< const octomap::OcTree > &octree, const Eigen::Affine3d &t)
std::map< std::string, CollisionDetectorPtr >::iterator CollisionDetectorIterator
#define ROS_ERROR_NAMED(name,...)
collision_detection::WorldPtr world_
void getCollisionObjectMsgs(std::vector< moveit_msgs::CollisionObject > &collision_objs) const
Construct a vector of messages (collision_objects) with the collision object data for all objects in ...
Representation of a robot's state. This includes position, velocity, acceleration and effort...
A link from the robot. Contains the constant transform applied to the link and its geometry...
Shape * constructShapeFromText(std::istream &in)
void getCollisionDetectorNames(std::vector< std::string > &names) const
get the types of collision detector that have already been added. These are the types which can be pa...
friend struct CollisionDetector
void getPlanningSceneDiffMsg(moveit_msgs::PlanningScene &scene) const
Fill the message scene with the differences between this instance of PlanningScene with respect to th...
const collision_detection::CollisionRobotConstPtr & getCollisionRobot() const
EigenSTL::vector_Affine3d shape_poses_
The poses of the corresponding entries in shapes_.
void loadGeometryFromStream(std::istream &in)
Load the geometry of the planning scene from a stream.
Object defining bodies that can be attached to robot links. This is useful when handling objects pick...
bool getOctomapMsg(octomap_msgs::OctomapWithPose &octomap) const
Construct a message (octomap) with the octomap data from the planning_scene.
void setRobotTrajectoryMsg(const robot_state::RobotState &reference_state, const trajectory_msgs::JointTrajectory &trajectory)
Copy the content of the trajectory message into this class. The trajectory message itself is not requ...
PlanningSceneConstPtr parent_
void getPlanningSceneMsg(moveit_msgs::PlanningScene &scene) const
Construct a message (scene) with all the necessary data so that the scene can be later reconstructed ...
boost::variant< shape_msgs::SolidPrimitive, shape_msgs::Mesh, shape_msgs::Plane > ShapeMsg
ConstraintEvaluationResult decide(const robot_state::RobotState &state, bool verbose=false) const
Determines whether all constraints are satisfied by state, returning a single evaluation result...
void saveGeometryToStream(std::ostream &out) const
Save the geometry of the planning scene to a stream, as plain text.
bool isStateColliding(const std::string &group="", bool verbose=false)
Check if the current state is in collision (with the environment or self collision). If a group name is specified, collision checking is done for that group only. Since the function is non-const, the current state transforms are updated before the collision check.
bool cost
If true, a collision cost is computed.
const collision_detection::CollisionWorldConstPtr & getCollisionWorld() const
Get the active collision detector for the world.
const collision_detection::WorldConstPtr & getWorld() const
Get the representation of the world.
const trajectory_msgs::JointTrajectory & getDetachPosture() const
Return the posture that is necessary for the object to be released, (if any). This is useful for exam...
bool setPlanningSceneDiffMsg(const moveit_msgs::PlanningScene &scene)
Apply changes to this planning scene as diffs, even if the message itself is not marked as being a di...
std::shared_ptr< const Shape > ShapeConstPtr
void checkCollisionUnpadded(const collision_detection::CollisionRequest &req, collision_detection::CollisionResult &res)
Check whether the current state is in collision, but use a collision_detection::CollisionRobot instan...