71 std::scoped_lock l(this->executionMutex);
76 <<
"A SKILL HAS ALREADY BEEN CONSTRUCTED. THIS SHOULD NOT HAPPEN!!";
84 const auto& initial_aron_params =
statusUpdate.parameters;
85 const auto& callback_interface =
statusUpdate.callbackInterface;
87 const auto& skillName = skillId.skillName;
88 const auto& providerId = *skillId.providerId;
89 const auto& executorName =
statusUpdate.executionId.executorName;
91 skills::manager::dti::SkillManagerInterfacePrx::checkedCast(callback_interface);
108 if (callback_interface)
110 auto pid = providerId.toCallbackIce();
111 callback_interface->updateStatusForSkill(
statusUpdate.toProviderIce(), pid);
126 << skillId.toString()
127 <<
"' has been scheduled > 1s ago. The execution should start "
128 "much faster! Continue, but this is bad behavior..";
135 ARMARX_INFO <<
"Construct skill `" << skillName <<
"`.";
140 this->skill->setExecutorName(executorName);
141 this->skill->setManager(manager);
143 { updateStatus(s, d); });
148 auto makeAbortedResult = [&](
const std::string& errorCode,
150 const std::string& message)
152 armarx::skills::arondto::SkillErrorResult errorResult;
153 errorResult.errorCode = errorCode;
154 errorResult.data =
data;
155 errorResult.errorMessage = message;
169 auto makeFailedResult = [&](
const std::string& errorCode,
171 const std::string& message)
173 armarx::skills::arondto::SkillErrorResult errorResult;
174 errorResult.errorCode = errorCode;
175 errorResult.data =
data;
176 errorResult.errorMessage = message;
204 auto exitAndMakeFailedResult = [&](
const std::string& errorCode,
206 const std::string& message)
209 return makeFailedResult(errorCode,
data, message);
211 auto exitAndMakeAbortedResult = [&](
const std::string& errorCode,
213 const std::string& message)
216 return makeAbortedResult(errorCode,
data, message);
231 std::string message =
"SkillError 101: The initialization of skill '" +
232 skillName +
"' did not succeed.";
233 return exitAndMakeFailedResult(
"101",
nullptr, message);
244 catch (
const std::exception& ex)
246 std::string message =
247 "SkillError 101e: An error occured during the initialization of skill '" +
250 return exitAndMakeFailedResult(
"101e",
nullptr, message);
262 auto prepareRet = skill->prepareSkill();
266 << skillName <<
" fulfilled. Waiting...";
269 std::this_thread::sleep_for(std::chrono::milliseconds(50));
270 prepareRet = skill->prepareSkill();
275 std::string message =
"SkillError 201: The prepare method of skill '" +
276 skillName +
"' did not succeed. ";
277 const bool shouldSkillTerminate = skill->shouldSkillTerminate();
279 return exitAndMakeFailedResult(
"201",
nullptr, message);
290 catch (
const std::exception& ex)
292 std::string message =
"SkillError 201e: An error occured during waiting for skill "
293 "dependencies of skill '" +
297 return exitAndMakeFailedResult(
"201e",
nullptr, message);
311 mainRet = skill->mainOfSkill();
314 std::string message =
315 "SkillError 501: The main method of skill '" + skillName +
"' did fail.";
317 return exitAndMakeFailedResult(
"501", mainRet.
data, message);
321 std::string message =
322 "SkillError 501: The main method of skill '" + skillName +
"' got aborted.";
323 return exitAndMakeAbortedResult(
"501", mainRet.
data, message);
334 catch (
const std::exception& ex)
336 std::string message =
337 "SkillError 501e: An error occured during the main method of skill '" +
340 return exitAndMakeFailedResult(
"501e", mainRet.
data, message);
353 std::string message =
"SkillError 601: The exit method of skill '" + skillName +
354 "' did not succeed.";
355 return makeFailedResult(
"601", mainRet.
data, message);
366 catch (
const std::exception& ex)
368 std::string message =
369 "SkillError 601e: An error occured during the exit method of skill '" +
372 return makeFailedResult(
"601e", mainRet.
data, message);