diff --git a/include/mplib/planning_world.h b/include/mplib/planning_world.h index 7a729ae..01d11e5 100644 --- a/include/mplib/planning_world.h +++ b/include/mplib/planning_world.h @@ -70,8 +70,8 @@ class PlanningWorldTpl { * * @return: list of non-articulated collision objects */ - std::vector getNormalObjects() const { - std::vector ret; + std::vector getNormalObjects() const { + std::vector ret; for (const auto &itm : normal_object_map_) ret.push_back(itm.second); return ret; } @@ -122,7 +122,10 @@ class PlanningWorldTpl { */ void setNormalObject(const std::string &name, const CollisionObjectPtr &collision_object) { - normal_object_map_[name] = collision_object; + FCLObject fcl_obj; + fcl_obj.collision_objects_.push_back(collision_object); + fcl_obj.tfs_.push_back(Isometry3::Identity()); + normal_object_map_[name] = fcl_obj; } /** @@ -274,7 +277,7 @@ class PlanningWorldTpl { std::vector articulations_; std::vector articulation_names_; - std::unordered_map normal_object_map_; + std::unordered_map normal_object_map_; int move_articulation_id_, attach_link_id_; CollisionObjectPtr point_cloud_, attached_tool_; diff --git a/src/planning_world.cpp b/src/planning_world.cpp index 0c5e754..1b5749d 100644 --- a/src/planning_world.cpp +++ b/src/planning_world.cpp @@ -32,7 +32,7 @@ PlanningWorldTpl::PlanningWorldTpl( ASSERT(normal_objects.size() == normal_object_names.size(), "normal_objects and normal_object_names should have the same size"); for (size_t i = 0; i < normal_objects.size(); i++) { - normal_object_map_[normal_object_names[i]] = normal_objects[i]; + setNormalObject(normal_object_names[i], normal_objects[i]); } } @@ -169,11 +169,8 @@ std::vector> PlanningWorldTpl::collideWithOthers( result.clear(); const std::string &normal_object_name = itm.first; const auto &normal_object = itm.second; - FCLObject normal_object_fcl; - normal_object_fcl.collision_objects_.push_back(normal_object); - normal_object_fcl.tfs_.push_back(Isometry3::Identity()); collision_detection::fcl::collideFCLObjects( - CollisionObjects[i], normal_object_fcl, request, result); + CollisionObjects[i], normal_object, request, result); if (result.isCollision()) { WorldCollisionResult tmp; tmp.res = result;