Skip to content

Commit 9c05305

Browse files
committed
ModifyPlanningScene: check state for collisions
1 parent a8896e4 commit 9c05305

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

core/src/stages/modify_planning_scene.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,17 @@ std::pair<InterfaceState, SubTrajectory> ModifyPlanningScene::apply(const Interf
151151

152152
if (callback_)
153153
callback_(scene, properties());
154+
155+
// check for collisions
156+
collision_detection::CollisionRequest req;
157+
collision_detection::CollisionResult res;
158+
req.contacts = true;
159+
req.max_contacts = 1;
160+
scene->checkCollision(req, res);
161+
if (res.collision) {
162+
const auto contact = res.contacts.begin()->second.front();
163+
traj.markAsFailure(contact.body_name_1 + " colliding with " + contact.body_name_2);
164+
}
154165
} catch (const std::exception& e) {
155166
traj.markAsFailure(e.what());
156167
}

0 commit comments

Comments
 (0)