5 namespace skills::detail
11 const skills::callback::dti::SkillProviderCallbackInterfacePrx& callbackInterface) :
12 factory(fac), statusUpdate{{execId, initial_parameters, callbackInterface}}
20 while (this->skill ==
nullptr)
23 <<
"Trying to stop a skill that has not been constructed yet... "
24 "Waiting until construction...";
25 std::this_thread::sleep_for(std::chrono::milliseconds(100));
28 this->skill->notifySkillToStop();
34 while (this->skill ==
nullptr)
37 <<
"Trying to add params to a skill that has not been constructed "
38 "yet... Waiting until construction...";
39 std::this_thread::sleep_for(std::chrono::milliseconds(100));
42 this->skill->updateParameters(i);
48 std::scoped_lock l(this->executionMutex);
53 <<
"A SKILL HAS ALREADY BEEN CONSTRUCTED. THIS SHOULD NOT HAPPEN!!";
65 const auto& skillName = skillId.
skillName;
66 const auto& providerId = *skillId.providerId;
69 skills::manager::dti::SkillManagerInterfacePrx::checkedCast(callback_interface);
85 if (callback_interface)
87 auto pid = providerId.toCallbackIce();
92 auto createErrorMessageData = [](
const std::string&
message)
96 obj->addElement(
"errormessage", m);
111 << skillId.toString()
112 <<
"' has been scheduled > 1s ago. The execution should start "
113 "much faster! Continue, but this is bad behavior..";
124 this->skill = this->factory->createSkill(providerId);
125 this->skill->setExecutorName(executorName);
126 this->skill->setManager(manager);
128 { updateStatus(
s, d); });
133 auto makeAbortedResult = [&](
const std::string&
message)
148 auto makeFailedResult = [&](
const std::string&
message)
177 auto exitAndMakeFailedResult = [&](
const std::string&
message)
180 return makeFailedResult(
message);
182 auto exitAndMakeAbortedResult = [&](
const std::string&
message)
185 return makeAbortedResult(
message);
200 std::string
message =
"SkillError 101: The initialization of skill '" +
201 skillName +
"' did not succeed.";
202 return exitAndMakeFailedResult(
message);
213 catch (
const std::exception& ex)
216 "SkillError 101e: An error occured during the initialization of skill '" +
219 return exitAndMakeFailedResult(
message);
231 auto prepareRet = skill->prepareSkill();
235 << skillName <<
" fulfilled. Waiting...";
238 std::this_thread::sleep_for(std::chrono::milliseconds(50));
239 prepareRet = skill->prepareSkill();
244 std::string
message =
"SkillError 201: The prepare method of skill '" +
245 skillName +
"' did not succeed.";
247 return exitAndMakeFailedResult(
message);
258 catch (
const std::exception& ex)
260 std::string
message =
"SkillError 201e: An error occured during waiting for skill "
261 "dependencies of skill '" +
265 return exitAndMakeFailedResult(
message);
279 mainRet = skill->mainOfSkill();
283 "SkillError 501: The main method of skill '" + skillName +
"' did fail.";
284 return exitAndMakeFailedResult(
message);
289 "SkillError 501: The main method of skill '" + skillName +
"' got aborted.";
290 return exitAndMakeAbortedResult(
message);
301 catch (
const std::exception& ex)
304 "SkillError 501e: An error occured during the main method of skill '" +
307 return exitAndMakeFailedResult(
message);
320 std::string
message =
"SkillError 601: The exit method of skill '" + skillName +
321 "' did not succeed.";
322 return makeFailedResult(
message);
333 catch (
const std::exception& ex)
336 "SkillError 601e: An error occured during the exit method of skill '" +
339 return makeFailedResult(
message);