Skip to content
Snippets Groups Projects
Commit 9bb36301 authored by Joana Plewnia's avatar Joana Plewnia
Browse files

removed legacy code

parent 8baa3aea
No related branches found
No related tags found
No related merge requests found
......@@ -115,7 +115,8 @@ namespace armarx::speech::object_last_seen_at::core
auto object_descriptions = remote.symbolicSceneReader->getLatestObjectDescriptions();
ARMARX_DEBUG << "Got description of objects";
//change the output of the object name (dont have any _ in it, dont have any numbers in it, in case of YCB)
//change the output of the object name (dont have any _ in it, dont have any numbers in it, in case of YCB);
//this is needed because in case of LTM we do not have the object id currently
const auto spokenObjectNameFromStringName = [](const std::string& objectName) -> std::string
{
std::string spokenName = objectName;
......@@ -243,126 +244,6 @@ namespace armarx::speech::object_last_seen_at::core
}
}
/** Legacy(only newest snapshot queried)
for (auto object_description : object_descriptions)
{
auto object_description_name = object_description.second.id;
std::transform(object_description_name.begin(),
object_description_name.end(),
object_description_name.begin(),
[](unsigned char c)
{ return std::tolower(c); }); //convert description name to lowercase
ARMARX_DEBUG << object_description_name;
if (object_description_name.find(object_name) != std::string::npos)
{ // object is in symbolic scene memory at the moment
if (object_description.second.objectAt != "(unknown)")
{ // this means a location for the object could be found
const std::string spokenName = getObjectSpokenNames(object_description.second.id)[0];
const std::string preposition = getPreposition(object_description.second.objectAt);
const std::string spokenLocationName =
getObjectSpokenNames(object_description.second.objectAt)[0];
const std::string answer = "I have last seen the " + spokenName + " " + preposition +
" the " + spokenLocationName;
this->subskills.say(answer);
try
{
//obtain the object pose from the object memory:
const armem::MemoryID sourceId = armem::MemoryID::fromString(object_description.second.source);
const armem::MemoryID coreSegmentID("Object", "Instance");
armem::client::Reader reader = this->remote.memoryNameSystem.getReader(coreSegmentID);
armem::client::QueryBuilder builder;
builder.coreSegments().withName(coreSegmentID.coreSegmentName)
.providerSegments().withName(sourceId.providerSegmentName)
.entities().withName(sourceId.entityName)
.snapshots().atTime(sourceId.timestamp);
armem::client::QueryResult result = reader.query(builder.buildQueryInput());
if (result.success)
{
armem::wm::Memory& memory = result.memory;
memory.forEachInstance([this, &sourceId](const armem::wm::EntityInstance& instance)
{
const armarx::armem::arondto::ObjectInstance i = armarx::armem::arondto::ObjectInstance::FromAron(instance.data());
objpose::ObjectPose pose;
armarx::armem::fromAron(i, pose);
// objpose::ObjectPose pose =
// armarx::aron::fromAron<objpose::ObjectPose>(
// armarx::armem::arondto::ObjectInstance::FromAron(instance.data())
// );
auto currentTime = armarx::armem::Time::Now();
//auto ageOfObjectInformation = currentTime.toSecondsSinceEpoch() - instance.metadata().sentTime.toSecondsSinceEpoch();
armarx::armem::arondto::ObjectInstance objectInstance;
armarx::objpose::toAron(objectInstance.pose, pose);
armem::MemoryID newObjectPoseClassID = armem::MemoryID("Object", "Class", "PriorKnowledgeData", sourceId.entityName);
armarx::armem::toAron(objectInstance.classID, newObjectPoseClassID);//objectClassId;
objectInstance.pose.confidence = 1.0; // we are sure about the location
objectInstance.pose.timestamp =
armarx::Clock::Now(); // we must update the timestamp
// store the object in the object memory
ARMARX_CHECK_NOT_NULL(this->remote.objectInstanceWriter);
ARMARX_CHECK(this->remote.objectInstanceWriter->commitObject(
objectInstance, properties.objectProviderName, armarx::Clock::Now()));
});
}
return true; // for now return here, later put this below
}
catch (const std::exception& e)
{
ARMARX_ERROR << "Error while updating object instance in object memory: " << e.what();
}
}
{ // if the location is unkown, we need to query the LTM
try{
const auto queryResult = queryLTM(object_description.second.id);
ARMARX_INFO << VAROUT(queryResult.locationName);
if (queryResult.locationName == "(unknown)")
{
std::string answer = "I cannot remember having seen the " +
spokenObjectNameFromStringName(object_name);
this->subskills.say(answer);
return true;
} else if (queryResult.locationName == "(aborted)")
{
ARMARX_INFO << "Aborted query";
return true;
}
std::string answer = "I have last seen the " +
spokenObjectNameFromStringName(object_name) + " " +
queryResult.locationName;
this->subskills.say(answer);
return true;
} catch (const std::exception& e)
{
ARMARX_ERROR << "Error while querying LTM: " << e.what();
return false;
}
}
}
}
*/
// object is not in symbolic scene memory (-> currently not visible) and we need to leverage the LTM
ARMARX_INFO << "Information not in WM, searching LTM";
const auto queryResult = queryLTM(object_name);
......
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