Incomplete.cpp
Go to the documentation of this file.
1 
2 
3 #include "Incomplete.h"
4 
5 #include <RobotAPI/components/skills/SkillProviderExample/aron/HelloWorldAcceptedType.aron.generated.h>
6 
7 #include "HelloWorld.h"
8 
10 {
11 
12  IncompleteSkill::IncompleteSkill() : SimpleSkill(GetSkillDescription())
13  {
14  }
15 
18  {
20  return SkillDescription{.skillId = {.skillName = "Incomplete"},
21  .description = d.description,
22  .rootProfileDefaults = armarx::aron::make_dict(),
23  .timeout = d.timeout + armarx::core::time::Duration::Seconds(2),
24  .parametersType = d.parametersType};
25  }
26 
28  IncompleteSkill::prepare()
29  {
30  if (!first_prepared)
31  {
32  first_prepared = true;
33 
34  // set parameters after two seconds...
35  std::thread foo(
36  [&]()
37  {
39  std::this_thread::sleep_for(std::chrono::milliseconds(2000));
40  this->setParameters(d.rootProfileDefaults);
41  });
42  foo.detach();
43  }
44 
46  }
47 
48  Skill::MainResult
49  IncompleteSkill::main(const MainInput& in)
50  {
51  auto s = HelloWorldSkill();
52  return s.mainOfSkill();
53  }
54 } // namespace armarx::skills::provider
armarx::skills::Skill::setParameters
void setParameters(const aron::data::DictPtr &d)
Hard set the parameters, ignoring everything that has been set or merged before.
Definition: Skill.cpp:121
armarx::skills::ActiveOrTerminatedSkillStatus::Succeeded
@ Succeeded
armarx::skills::Skill::PrepareResult
A result struct for skill preparing.
Definition: Skill.h:33
armarx::aron::make_dict
aron::data::DictPtr make_dict(_Args &&... args)
Definition: Dict.h:107
armarx::skills::SkillID::skillName
std::string skillName
Definition: SkillID.h:41
armarx::skills::SkillDescription
Definition: SkillDescription.h:17
armarx::skills::provider::IncompleteSkill::GetSkillDescription
static SkillDescription GetSkillDescription()
Definition: Incomplete.cpp:17
HelloWorld.h
armarx::core::time::Duration::Seconds
static Duration Seconds(std::int64_t seconds)
Constructs a duration in seconds.
Definition: Duration.cpp:72
Incomplete.h
armarx::skills::SkillDescription::skillId
SkillID skillId
Definition: SkillDescription.h:19
armarx::skills::provider
Definition: BusyWaiting.cpp:6
armarx::skills::SimpleSkill
Definition: SimpleSkill.h:9
armarx::skills::provider::IncompleteSkill::IncompleteSkill
IncompleteSkill()
Definition: Incomplete.cpp:12
armarx::skills::SimpleSkill::main
MainResult main() final
Override this method with the actual implementation. The callback is for status updates to the callin...
Definition: SimpleSkill.cpp:15
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
armarx::skills::provider::HelloWorldSkill::GetSkillDescription
static SkillDescription GetSkillDescription()
Definition: HelloWorld.cpp:17