55 reader.connect(memoryNameSystem);
60 const std::string& provider,
68 const std::vector<HumanRobotInteraction>& interactions,
69 const std::string& provider,
72 if (interactions.empty())
81 std::map<std::string, std::vector<HumanRobotInteraction>> interactionsByPerson;
85 std::string entityName;
86 if (interaction.personID.has_value())
88 entityName = interaction.personID.value().toMemoryEntityID();
93 entityName =
"unknown-person";
96 interactionsByPerson[entityName].push_back(interaction);
100 for (
const auto& [entityName, entityInteractions] : interactionsByPerson)
103 std::vector<armarx::aron::data::DictPtr> interactionDtos;
106 armarx::human::arondto::HumanRobotInteraction interactionAron;
107 toAron(interactionAron, interaction);
108 interactionDtos.push_back(interactionAron.toAron());
114 .withProviderSegmentName(provider)
115 .withEntityName(entityName);
125 .entityID = entityId,
126 .instancesData = interactionDtos,
127 .referencedTime = referencedTime,
137 ARMARX_INFO <<
"Committing " << entityInteractions.size()
138 <<
" interactions for entity " << entityName;
std::string coreSegmentName
std::string str(bool escapeDelimiters=true) const
Get a string representation of this memory ID.
std::string providerSegmentName
The memory name system (MNS) client.
CommitResult commit(const Commit &commit) const
Writes a Commit to the memory.
armem::client::Writer & memoryWriter()
void connect(armarx::armem::client::MemoryNameSystem &mns)
void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &def)
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
~InteractionWriter() override
bool commitHumanRobotInteractions(const std::vector< HumanRobotInteraction > &interactions, const std::string &provider, const armem::Time &referencedTime)
bool commitHumanRobotInteraction(const HumanRobotInteraction &interaction, const std::string &provider, const armem::Time &referencedTime)
void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &def)
#define ARMARX_INFO
The normal logging level.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
#define ARMARX_VERBOSE
The logging level for verbose information.
void toAron(armarx::human::arondto::HumanPose &dto, const HumanPose &bo)
armarx::core::time::DateTime Time
const armem::MemoryID HumanRobotInteractionCoreSegmentID
std::string GetHandledExceptionString()
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
A bundle of updates to be sent to the memory.
std::vector< EntityUpdate > updates
The entity updates.
An update of an entity for a specific point in time.