3 #include <IceUtil/Time.h>
4 #include <SimoxUtility/algorithm/get_map_keys_values.h>
14 #include <RobotAPI/libraries/armem_robot/aron/RobotDescription.aron.generated.h>
15 #include <RobotAPI/libraries/armem_robot/aron/Robot.aron.generated.h>
23 memoryNameSystem(memoryNameSystem)
30 const std::string prefix = propertyPrefix;
32 def->optional(properties.memoryName, prefix +
"MemoryName");
34 def->optional(properties.coreAttachmentsSegmentName,
35 prefix +
"CoreSegment",
36 "Name of the memory core segment to use for object attachments.");
37 def->optional(properties.providerName, prefix +
"ProviderName");
43 ARMARX_IMPORTANT <<
"Writer: Waiting for memory '" << properties.memoryName <<
"' ...";
46 memoryWriter = memoryNameSystem.
useWriter(properties.memoryName);
47 memoryReader = memoryNameSystem.
useReader(properties.memoryName);
48 ARMARX_IMPORTANT <<
"Writer: Connected to memory '" << properties.memoryName <<
"'";
60 std::lock_guard g{memoryWriterMutex};
62 const auto result = memoryWriter.
addSegment(properties.coreAttachmentsSegmentName, properties.providerName);
64 if (not result.success)
66 ARMARX_ERROR <<
"Creating core segment failed. Reason: " << result.errorMessage;
70 const auto& timestamp = attachment.
timestamp;
76 .withTimestamp(timestamp);
79 update.entityID = entityID;
81 arondto::attachment::ObjectAttachment aronAttachment;
82 toAron(aronAttachment, attachment);
84 update.instancesData = {aronAttachment.toAron()};
85 update.referencedTime = timestamp;
92 if (not updateResult.success)
98 return updateResult.snapshotID;
104 std::lock_guard g{memoryWriterMutex};
106 const auto result = memoryWriter.
addSegment(properties.coreAttachmentsSegmentName, properties.providerName);
108 if (not result.success)
110 ARMARX_ERROR <<
"Creating core segment failed. Reason: " << result.errorMessage;
114 const auto& timestamp = attachment.
timestamp;
117 const auto entityID =
120 .withTimestamp(timestamp);
123 update.entityID = entityID;
125 arondto::attachment::ArticulatedObjectAttachment aronAttachment;
126 toAron(aronAttachment, attachment);
128 update.instancesData = {aronAttachment.toAron()};
129 update.referencedTime = timestamp;
136 if (not updateResult.success)
142 return updateResult.snapshotID;