41 "human_robot_interaction_debugger";
48 def->defineRequiredProperty<std::string>(
"robotName");
84 HumanRobotInteractionDebugger::run()
86 ARMARX_INFO <<
"Use 'interaction [firstName] [lastName] [interactionType] "
87 "[interactionName] [robotName] [confidence]' to commit an interaction";
88 ARMARX_INFO <<
" Interaction types: HANDOVER, ANSWERING_QUESTION, SERVING_DRINK, "
89 "SERVING_FOOD, GUIDING, ASSISTING, CONVERSATION, GREETING, FAREWELL";
90 ARMARX_INFO <<
" Example: interaction John Doe HANDOVER HandoverBottle Armar6 0.95";
91 ARMARX_INFO <<
"Use 'read' to read all interactions";
97 if (command ==
"interaction")
101 else if (command ==
"read")
103 readInteractionCommand();
105 else if (command ==
"exit")
120 HumanRobotInteractionDebugger::interactionCommand()
122 std::string firstName, lastName, interactionTypeStr, interactionName, robotName,
124 std::cin >> firstName >> lastName >> interactionTypeStr >> interactionName >> robotName >>
127 float confidence = std::stof(confidenceStr);
133 std::string interactionTypeUpper = simox::alg::to_upper(interactionTypeStr);
135 if (interactionTypeUpper ==
"HANDOVER")
137 else if (interactionTypeUpper ==
"ANSWERING_QUESTION")
139 else if (interactionTypeUpper ==
"SERVING_DRINK")
141 else if (interactionTypeUpper ==
"SERVING_FOOD")
143 else if (interactionTypeUpper ==
"GUIDING")
145 else if (interactionTypeUpper ==
"ASSISTING")
147 else if (interactionTypeUpper ==
"CONVERSATION")
149 else if (interactionTypeUpper ==
"GREETING")
151 else if (interactionTypeUpper ==
"FAREWELL")
153 else if (interactionTypeUpper ==
"CUSTOM")
157 ARMARX_WARNING <<
"Unknown interaction type: " << interactionTypeStr
158 <<
". Using UNKNOWN.";
161 commitInteraction(firstName, lastName, interactionType, interactionName, robotName, confidence);
165 HumanRobotInteractionDebugger::readInteractionCommand()
168 armarx::armem::human::client::InteractionReader::Query query = {
173 auto result = interactionReader.query(query,
true);
177 ARMARX_WARNING <<
"Failed to read interactions from memory: " << result.errorMessage;
181 if (result.interactions.empty())
187 ARMARX_INFO <<
"Interactions in memory (" << result.interactions.size() <<
" total):";
188 for (
const auto& interaction : result.interactions)
225 HumanRobotInteractionDebugger::commitInteraction(
226 const std::string& firstName,
227 const std::string& lastName,
229 const std::string& interactionName,
230 const std::string& robotName,
234 armarx::armem::human::HumanRobotInteraction
interaction;
243 armarx::armem::human::PersonID personID;
248 interaction.description =
"Debug interaction created by HumanRobotInteractionDebugger";
252 ARMARX_INFO <<
"Committing interaction '" << interactionName <<
"' for person " << firstName
253 <<
" " << lastName <<
" with robot " << robotName <<
" (entity: " << entityName
254 <<
") with confidence " << confidence;
256 bool success = interactionWriter.commitHumanRobotInteraction(
261 ARMARX_INFO <<
"Successfully committed interaction.";
272 return "HumanRobotInteractionDebugger";