Skip to content

Commit

Permalink
collision_detection::World::moveObject() (#957)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaschke authored and v4hn committed Jun 25, 2018
1 parent a989aa4 commit d3d8887
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Expand Up @@ -157,6 +157,9 @@ class World
* verified by comparing pointers. Returns true on success. */
bool moveShapeInObject(const std::string& id, const shapes::ShapeConstPtr& shape, const Eigen::Affine3d& pose);

/** \brief Move all shapes in an object according to the given transform specified in world frame */
bool moveObject(const std::string& id, const Eigen::Affine3d& transform);

/** \brief Remove shape from object.
* Shape equality is verified by comparing pointers. Ownership of the
* object is renounced (i.e. object is deleted if no external references
Expand Down
16 changes: 15 additions & 1 deletion moveit_core/collision_detection/src/world.cpp
Expand Up @@ -155,6 +155,20 @@ bool World::moveShapeInObject(const std::string& id, const shapes::ShapeConstPtr
return false;
}

bool World::moveObject(const std::string& id, const Eigen::Affine3d& transform)
{
auto it = objects_.find(id);
if (it == objects_.end())
return false;
ensureUnique(it->second);
for (size_t i = 0, n = it->second->shapes_.size(); i < n; ++i)
{
it->second->shape_poses_[i] = transform * it->second->shape_poses_[i];
}
notify(it->second, MOVE_SHAPE);
return true;
}

bool World::removeShapeFromObject(const std::string& id, const shapes::ShapeConstPtr& shape)
{
auto it = objects_.find(id);
Expand Down Expand Up @@ -247,4 +261,4 @@ void World::notifyObserverAllObjects(const ObserverHandle observer_handle, Actio
}
}

} // end of namespace collision_detection
} // end of namespace collision_detection

0 comments on commit d3d8887

Please sign in to comment.