34 putAwayLocation(PredicateInfo{
"putAwayLocation", 2})
57 getProxy(psr,
"GraphNodePoseResolver");
60 cpl->setLTMSegmentName(cplSegmentName);
61 objectInstances =
wm->getObjectInstancesSegment();
62 graphSegment = prior->getGraphSegment();
68 return "PutAwayLocationPredicateProvider";
74 return {putAwayLocation};
80 PredicateInstanceList result;
81 const std::string predicateName = putAwayLocation.name;
83 for (
const auto& entity : objectInstances->getAllEntities())
85 auto entry = getCacheEntry(ObjectInstancePtr::dynamicCast(entity)->getMostProbableClass());
86 if (entry.putAwayNodeRef)
88 result.push_back(PredicateInstance{
90 {objectInstances->getEntityRefById(entity->getId()), entry.putAwayNodeRef},
98PutAwayLocationPredicateProvider::CachedCommonPlace
99PutAwayLocationPredicateProvider::getCacheEntry(
const std::string& className)
101 auto it = cpCache.find(className);
102 if (it != cpCache.end())
107 if (cplObjects.empty())
109 cplObjectsSegment = ltm->getCustomInstancesSegment(cplSegmentName,
false);
110 if (!cplObjectsSegment)
112 throw armarx::LocalException(
"No LTM segment named '") << cplSegmentName <<
"'";
115 auto entities = cplObjectsSegment->getAllEntities();
116 std::transform(entities.cbegin(),
118 std::back_inserter(cplObjects),
119 [](
const EntityBasePtr& e) { return ObjectInstancePtr::dynamicCast(e); });
122 EntityRefBasePtr nodeRef;
123 for (
const auto& cplInstance : cplObjects)
125 if (cplInstance->getMostProbableClass() == className)
127 memoryx::Cluster3DList clusterList =
128 cpl->getPositionClustersByComponentCount(cplInstance->getName(), 1);
129 if (!clusterList.empty())
131 auto cluster = clusterList.front();
132 nodeRef = graphSegment->getEntityRefById(psr->getNearestNodeIdToPosition(
133 sceneName,
"putdownlocation", cluster.center.x, cluster.center.y));
142 << nodeRef->entityName <<
"'";
145 CachedCommonPlace result{className, nodeRef};
146 cpCache.insert({className, result});
Property< PropertyType > getProperty(const std::string &name)
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
void onConnectWorldStateUpdater() override
void onInitWorldStateUpdater() override
PredicateInstanceList calcPredicates(const Ice::Current &) override
PutAwayLocationPredicateProvider()
PredicateInfoList getPredicateInfos(const Ice::Current &c=Ice::emptyCurrent) override
std::string getDefaultName() const override
Retrieve default name of component.
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...