6 #include <IceUtil/Time.h>
8 #include <SimoxUtility/algorithm/get_map_keys_values.h>
17 #include <RobotAPI/libraries/armem_robot_state/aron/Robot.aron.generated.h>
18 #include <RobotAPI/libraries/armem_robot_state/aron/RobotDescription.aron.generated.h>
25 memoryNameSystem(memoryNameSystem)
34 const std::string prefix = propertyPrefix;
36 def->optional(properties.memoryName, prefix +
"MemoryName");
38 def->optional(properties.coreAttachmentsSegmentName,
39 prefix +
"CoreSegment",
40 "Name of the memory core segment to use for object attachments.");
41 def->optional(properties.providerName, prefix +
"ProviderName");
48 ARMARX_IMPORTANT <<
"Writer: Waiting for memory '" << properties.memoryName <<
"' ...";
51 memoryWriter = memoryNameSystem.
useWriter(properties.memoryName);
52 memoryReader = memoryNameSystem.
useReader(properties.memoryName);
53 ARMARX_IMPORTANT <<
"Writer: Connected to memory '" << properties.memoryName <<
"'";
62 std::optional<armem::MemoryID>
65 std::lock_guard g{memoryWriterMutex};
68 memoryWriter.
addSegment(properties.coreAttachmentsSegmentName, properties.providerName);
70 if (not result.success)
72 ARMARX_ERROR <<
"Creating core segment failed. Reason: " << result.errorMessage;
76 const auto& timestamp = attachment.
timestamp;
82 .withTimestamp(timestamp);
85 update.entityID = entityID;
87 arondto::attachment::ObjectAttachment aronAttachment;
88 toAron(aronAttachment, attachment);
90 update.instancesData = {aronAttachment.toAron()};
91 update.referencedTime = timestamp;
98 if (not updateResult.success)
104 return updateResult.snapshotID;
107 std::optional<armem::MemoryID>
110 std::lock_guard g{memoryWriterMutex};
113 memoryWriter.
addSegment(properties.coreAttachmentsSegmentName, properties.providerName);
115 if (not result.success)
117 ARMARX_ERROR <<
"Creating core segment failed. Reason: " << result.errorMessage;
121 const auto& timestamp = attachment.
timestamp;
124 const auto entityID =
127 .withTimestamp(timestamp);
130 update.entityID = entityID;
132 arondto::attachment::ArticulatedObjectAttachment aronAttachment;
133 toAron(aronAttachment, attachment);
135 update.instancesData = {aronAttachment.toAron()};
136 update.referencedTime = timestamp;
143 if (not updateResult.success)
149 return updateResult.snapshotID;