31 using namespace MemoryXUtility;
38 memoryx::ObjectInstanceMemorySegmentBasePrx instancesSegment = getWorkingMemory()->getObjectInstancesSegment();
39 if (in.isObjectClassNameSet() and not in.getObjectClassName().empty())
41 std::string objectClassName = in.getObjectClassName();
42 if (objectClassName.find(
"/") != std::string::npos)
46 ARMARX_INFO <<
"Got an ObjectID as class name: " << objectClassName;
48 objpose::DetachObjectFromRobotNodeInput
input;
50 getObjectPoseStorage()->detachObjectFromRobotNode(
input);
54 memoryx::ObjectInstanceList instances = instancesSegment->getObjectInstancesByClass(objectClassName);
55 ARMARX_INFO <<
"Removing " << instances.size() <<
" of object class '" << objectClassName <<
"'";
56 for (memoryx::ObjectInstanceBasePtr
const& instance : instances)
58 std::string
id = instance->getId();
59 ARMARX_INFO <<
"Removing object of class '" << objectClassName <<
"' with id '" <<
id <<
"'";
61 instancesSegment->removeEntity(
id);
65 else if (in.isObjectInstanceChannelSet() || in.isObjectInstanceIdSet())
67 const std::string
id = in.isObjectInstanceIdSet() ? in.getObjectInstanceId() : in.getObjectInstanceChannel()->getDataField(
"id")->getString();
68 ARMARX_INFO <<
"Removing object with id '" <<
id <<
"'";
70 instancesSegment->removeEntity(
id);