@@ -283,24 +283,14 @@ bool plan_execution::PlanExecution::isRemainingPathValid(const ExecutableMotionP
283
283
collision_detection::CollisionRequest req;
284
284
req.group_name = t.getGroupName ();
285
285
req.pad_environment_collisions = false ;
286
- auto getAttachedObjects = [](const moveit::core::RobotState& state) {
287
- std::vector<const moveit::core::AttachedBody*> attached_bodies;
288
- state.getAttachedBodies (attached_bodies);
289
- std::map<std::string, const moveit::core::AttachedBody*> attached_objects;
290
- for (const auto & ab : attached_bodies)
291
- {
292
- attached_objects[ab->getName ()] = ab;
293
- }
294
- return attached_objects;
295
- };
296
-
297
286
moveit::core::RobotState state = plan.planning_scene ->getCurrentState ();
298
- std::map<std::string, const moveit::core::AttachedBody*> current_attached_objects = getAttachedObjects (state);
287
+ std::map<std::string, const moveit::core::AttachedBody*> current_attached_objects, sample_attached_object;
288
+ state.getAttachedBodies (current_attached_objects);
299
289
for (std::size_t i = std::max (path_segment.second - 1 , 0 ); i < wpc; ++i)
300
290
{
301
291
state = t.getWayPoint (i);
302
292
collision_detection::CollisionResult res;
303
- std::map<std::string, const moveit::core::AttachedBody*> sample_attached_object = getAttachedObjects ( state);
293
+ state. getAttachedBodies (sample_attached_object );
304
294
305
295
// If sample state has attached objects that are not in the current state, remove them from the sample state
306
296
for (const auto & [name, object] : sample_attached_object)
0 commit comments