Skip to content
Snippets Groups Projects

Draft: Make RobotStateMemory ready

Merged Rainer Kartmann requested to merge armem/robot-state-memory into master
2 files
+ 32
14
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -168,30 +168,40 @@ namespace armarx::armem::server::robot_state::localization
}
bool Segment::storeTransform(const armarx::armem::robot_state::Transform& transform)
bool Segment::commitTransform(const armarx::armem::robot_state::Transform& transform)
{
const armem::Time& timestamp = transform.header.timestamp;
Commit commit;
commit.add(makeUpdate(transform));
const MemoryID providerID =
coreSegment->id().withProviderSegmentName(transform.header.agent);
if (not coreSegment->hasProviderSegment(providerID.providerSegmentName))
{
coreSegment->addProviderSegment(providerID.providerSegmentName, arondto::Transform::toAronType());
}
const armem::CommitResult result = iceMemory.commit(commit);
return result.allSuccess();
}
bool Segment::commitTransformLocking(const armarx::armem::robot_state::Transform& transform)
{
Commit commit;
commit.add(makeUpdate(transform));
EntityUpdate& update = commit.updates.emplace_back();
update.entityID =
providerID.withEntityName(transform.header.parentFrame + "," + transform.header.frame);
const armem::CommitResult result = iceMemory.commitLocking(commit);
return result.allSuccess();
}
EntityUpdate Segment::makeUpdate(const armarx::armem::robot_state::Transform& transform) const
{
const armem::Time& timestamp = transform.header.timestamp;
const MemoryID providerID = coreSegment->id().withProviderSegmentName(transform.header.agent);
EntityUpdate update;
update.entityID = providerID.withEntityName(transform.header.parentFrame + "," + transform.header.frame);
update.timeArrived = update.timeCreated = update.timeSent = timestamp;
arondto::Transform aronTransform;
toAron(aronTransform, transform);
update.instancesData = {aronTransform.toAron()};
const armem::CommitResult result = iceMemory.commit(commit);
return result.allSuccess();
return update;
}
} // namespace armarx::armem::server::robot_state::localization
Loading