Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PS: do not list object as destroyed when they get attached #2864

Merged
merged 2 commits into from Sep 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 18 additions & 5 deletions moveit_core/planning_scene/src/planning_scene.cpp
Expand Up @@ -693,11 +693,20 @@ void PlanningScene::getPlanningSceneDiffMsg(moveit_msgs::PlanningScene& scene_ms
do_omap = true;
else if (it.second == collision_detection::World::DESTROY)
{
moveit_msgs::CollisionObject co;
co.header.frame_id = getPlanningFrame();
co.id = it.first;
co.operation = moveit_msgs::CollisionObject::REMOVE;
scene_msg.world.collision_objects.push_back(co);
// if object became attached, it should not be recorded as removed here
if (!std::count_if(scene_msg.robot_state.attached_collision_objects.cbegin(),
scene_msg.robot_state.attached_collision_objects.cend(),
[&it](const moveit_msgs::AttachedCollisionObject& aco) {
return aco.object.id == it.first &&
aco.object.operation == moveit_msgs::CollisionObject::ADD;
}))
{
moveit_msgs::CollisionObject co;
co.header.frame_id = getPlanningFrame();
co.id = it.first;
co.operation = moveit_msgs::CollisionObject::REMOVE;
scene_msg.world.collision_objects.push_back(co);
}
}
else
{
Expand Down Expand Up @@ -1818,7 +1827,11 @@ bool PlanningScene::processCollisionObjectRemove(const moveit_msgs::CollisionObj
else
{
if (!world_->removeObject(object.id))
{
ROS_WARN_STREAM_NAMED(LOGNAME,
"Tried to remove world object '" << object.id << "', but it does not exist in this scene.");
return false;
}

removeObjectColor(object.id);
removeObjectType(object.id);
Expand Down