Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Speech
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
Skills
Speech
Commits
9bb36301
Commit
9bb36301
authored
3 months ago
by
Joana Plewnia
Browse files
Options
Downloads
Patches
Plain Diff
removed legacy code
parent
8baa3aea
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/armarx/speech/skills/object_last_seen_at/core/ObjectLastSeenAt.cpp
+2
-121
2 additions, 121 deletions
...eech/skills/object_last_seen_at/core/ObjectLastSeenAt.cpp
with
2 additions
and
121 deletions
source/armarx/speech/skills/object_last_seen_at/core/ObjectLastSeenAt.cpp
+
2
−
121
View file @
9bb36301
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment