6 #include <RobotAPI/libraries/skills/core/aron/SkillErrorResult.aron.generated.h>
11 namespace skills::detail
17 const skills::callback::dti::SkillProviderCallbackInterfacePrx& callbackInterface) :
18 factory(fac), statusUpdate{{execId, initial_parameters, callbackInterface}}
26 while (this->skill ==
nullptr)
29 <<
"Trying to stop a skill that has not been constructed yet... "
30 "Waiting until construction...";
31 std::this_thread::sleep_for(std::chrono::milliseconds(100));
34 this->skill->notifySkillToStop();
40 while (this->skill ==
nullptr)
43 <<
"Trying to add params to a skill that has not been constructed "
44 "yet... Waiting until construction...";
45 std::this_thread::sleep_for(std::chrono::milliseconds(100));
48 this->skill->updateParameters(i);
54 std::scoped_lock l(this->executionMutex);
59 <<
"A SKILL HAS ALREADY BEEN CONSTRUCTED. THIS SHOULD NOT HAPPEN!!";
71 const auto& skillName = skillId.
skillName;
72 const auto& providerId = *skillId.providerId;
75 skills::manager::dti::SkillManagerInterfacePrx::checkedCast(callback_interface);
92 if (callback_interface)
94 auto pid = providerId.toCallbackIce();
110 << skillId.toString()
111 <<
"' has been scheduled > 1s ago. The execution should start "
112 "much faster! Continue, but this is bad behavior..";
123 this->skill = this->factory->createSkill(providerId);
124 this->skill->setExecutorName(executorName);
125 this->skill->setManager(manager);
127 { updateStatus(
s, d); });
132 auto makeAbortedResult = [&](
const std::string& errorCode,
136 armarx::skills::arondto::SkillErrorResult errorResult;
137 errorResult.errorCode = errorCode;
138 errorResult.data =
data;
139 errorResult.errorMessage =
message;
154 auto makeFailedResult = [&](
const std::string& errorCode,
158 armarx::skills::arondto::SkillErrorResult errorResult;
159 errorResult.errorCode = errorCode;
160 errorResult.data =
data;
161 errorResult.errorMessage =
message;
190 auto exitAndMakeFailedResult = [&](
const std::string& errorCode,
197 auto exitAndMakeAbortedResult = [&](
const std::string& errorCode,
202 return makeAbortedResult(errorCode,
data,
message);
217 std::string
message =
"SkillError 101: The initialization of skill '" +
218 skillName +
"' did not succeed.";
219 return exitAndMakeFailedResult(
"101",
nullptr,
message);
230 catch (
const std::exception& ex)
233 "SkillError 101e: An error occured during the initialization of skill '" +
236 return exitAndMakeFailedResult(
"101e",
nullptr,
message);
248 auto prepareRet = skill->prepareSkill();
252 << skillName <<
" fulfilled. Waiting...";
255 std::this_thread::sleep_for(std::chrono::milliseconds(50));
256 prepareRet = skill->prepareSkill();
261 std::string
message =
"SkillError 201: The prepare method of skill '" +
262 skillName +
"' did not succeed.";
264 return exitAndMakeFailedResult(
"201",
nullptr,
message);
275 catch (
const std::exception& ex)
277 std::string
message =
"SkillError 201e: An error occured during waiting for skill "
278 "dependencies of skill '" +
282 return exitAndMakeFailedResult(
"201e",
nullptr,
message);
296 mainRet = skill->mainOfSkill();
300 "SkillError 501: The main method of skill '" + skillName +
"' did fail.";
302 return exitAndMakeFailedResult(
"501", mainRet.
data,
message);
307 "SkillError 501: The main method of skill '" + skillName +
"' got aborted.";
308 return exitAndMakeAbortedResult(
"501", mainRet.
data,
message);
319 catch (
const std::exception& ex)
322 "SkillError 501e: An error occured during the main method of skill '" +
325 return exitAndMakeFailedResult(
"501e", mainRet.
data,
message);
338 std::string
message =
"SkillError 601: The exit method of skill '" + skillName +
339 "' did not succeed.";
340 return makeFailedResult(
"601", mainRet.
data,
message);
351 catch (
const std::exception& ex)
354 "SkillError 601e: An error occured during the exit method of skill '" +
357 return makeFailedResult(
"601e", mainRet.
data,
message);