Skip to content
Snippets Groups Projects
Commit db900c4b authored by Fabian Reister's avatar Fabian Reister
Browse files

properly setting memory id in class segment

parent 2b0dfc28
No related branches found
No related tags found
2 merge requests!157armem/dev => master,!148ArMem: articulated object localizer related stuff
#include "Segment.h"
#include <SimoxUtility/algorithm/get_map_keys_values.h>
#include <sstream>
#include <ArmarXCore/core/time/TimeUtil.h>
......@@ -66,7 +67,7 @@ namespace armarx::armem::server::obj::articulated_object_class
ObjectFinder finder(package);
const auto knownArticulatedObjectDescriptions = finder.findAllArticulatedObjectsByDataset(true);
ARMARX_INFO << "Found " << knownArticulatedObjectDescriptions.size() << " articulated objects";
ARMARX_DEBUG << "Found " << knownArticulatedObjectDescriptions.size() << " articulated objects";
loadObjectsIntoMemory(knownArticulatedObjectDescriptions, package);
}
......@@ -114,18 +115,21 @@ namespace armarx::armem::server::obj::articulated_object_class
{
for (const auto& [name, entity] : provSeg.entities())
{
const auto& entityInstance = entity.getLatestSnapshot().getInstance(0);
const auto description = robot::convertRobotDescription(entityInstance);
if (not description)
for (const auto& snapshot : simox::alg::get_values(entity.history()))
{
ARMARX_WARNING << "Could not convert entity instance to 'RobotDescription'";
continue;
}
const auto& entityInstance = snapshot.getInstance(0);
const auto description = robot::convertRobotDescription(entityInstance);
ARMARX_DEBUG << "Key is " << armem::MemoryID(entity.id());
if (not description)
{
ARMARX_WARNING << "Could not convert entity instance to 'RobotDescription'";
continue;
}
objects.emplace(armem::MemoryID(entity.id()), *description);
ARMARX_DEBUG << "Key is " << armem::MemoryID(snapshot.id());
objects.emplace(armem::MemoryID(snapshot.id()), *description);
}
}
}
......
......@@ -70,11 +70,20 @@ namespace armarx::armem::server::obj::articulated_object_instance
ARMARX_CHECK_NOT_NULL(classSegment);
const auto knownObjectClasses = classSegment->getKnownObjectClasses();
ARMARX_DEBUG << "Class segment has " << knownObjectClasses.size() << " known articulated objects";
const auto escape = [](std::string & v)
{
v = simox::alg::replace_all(v, "/", "\\/");
};
const auto resolveDescriptionLink = [&](auto & articulatedObject, const auto & aronDescriptionLink) -> bool
{
armem::MemoryID descriptionLink;
fromAron(aronDescriptionLink, descriptionLink);
escape(descriptionLink.providerSegmentName);
ARMARX_DEBUG << "Lookup key is " << descriptionLink;
// const auto keys = simox::alg::get_keys(knownObjectClasses);
......@@ -83,7 +92,8 @@ namespace armarx::armem::server::obj::articulated_object_instance
const auto it = knownObjectClasses.find(descriptionLink);
if (it == knownObjectClasses.end())
{
ARMARX_WARNING << "Unknown object class " ; //<< aronArticulatedObject.description;
ARMARX_WARNING << "Unknown object class " << descriptionLink
<< "Known classes are " << simox::alg::get_keys(knownObjectClasses);
return false;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment