InstantKill.cpp
Go to the documentation of this file.
1
2
#include <cstdlib>
3
#include "
InstantKill.h
"
4
5
#include <thread>
6
#include <chrono>
7
8
namespace
armarx::skills::provider
9
{
10
11
InstantKillSkill::InstantKillSkill
() :
SimpleSkill
(GetSkillDescription())
12
{
13
}
14
15
SkillDescription
16
InstantKillSkill::GetSkillDescription
()
17
{
18
return
SkillDescription
{.
skillId
=
armarx::skills::SkillID
{.
skillName
=
"InstantKill"
},
19
.description =
20
"This skill calls Timeout and instantly aboirts it."
,
21
.timeout =
armarx::core::time::Duration::MilliSeconds
(50000)};
22
}
23
24
Skill::MainResult
25
InstantKillSkill::main
(
const
MainInput& in)
26
{
27
28
this->
throwIfSkillShouldTerminate
();
29
30
SkillProxy
prx(
31
manager
,
32
skills::SkillID
{.
providerId
= *
getSkillId
().
providerId
, .skillName =
"Chaining"
});
33
34
for
(
unsigned
int
i = 0; i < 10; ++i)
35
{
36
auto
id
=
callSubskillAsync
(prx);
37
prx.abortSkillAsync(
id
);
38
}
39
return
{
TerminatedSkillStatus::Succeeded
,
nullptr
};
40
}
41
}
// namespace armarx::skills::provider
armarx::skills::Skill::manager
manager::dti::SkillManagerInterfacePrx manager
Definition:
Skill.h:327
armarx::skills::TerminatedSkillStatus::Succeeded
@ Succeeded
armarx::skills::SkillID::skillName
std::string skillName
Definition:
SkillID.h:60
armarx::skills::SkillDescription
Definition:
SkillDescription.h:18
InstantKill.h
armarx::skills::SkillID::providerId
std::optional< ProviderID > providerId
Definition:
SkillID.h:59
armarx::skills::Skill::callSubskillAsync
skills::SkillExecutionID callSubskillAsync(const skills::SkillProxy &proxy)
Similar to callSubskill but non-blocking.
Definition:
Skill.cpp:43
armarx::skills::provider::InstantKillSkill::InstantKillSkill
InstantKillSkill()
Definition:
InstantKill.cpp:11
armarx::skills::SkillProxy
Definition:
SkillProxy.h:11
armarx::skills::SkillDescription::skillId
SkillID skillId
Definition:
SkillDescription.h:20
armarx::skills::provider
Definition:
BusyWaiting.cpp:6
armarx::skills::Skill::MainResult
A result struct for th main method of a skill.
Definition:
Skill.h:48
armarx::skills::SimpleSkill
Definition:
SimpleSkill.h:9
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::skills::Skill::throwIfSkillShouldTerminate
void throwIfSkillShouldTerminate(const std::string &abortedMessage="")
Definition:
Skill.cpp:291
armarx::skills::SkillID
Definition:
SkillID.h:17
armarx::skills::Skill::getSkillId
SkillID getSkillId() const
Get the id of the skill.
Definition:
Skill.h:74
armarx::core::time::Duration::MilliSeconds
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition:
Duration.cpp:55
armarx::skills::provider::InstantKillSkill::GetSkillDescription
static SkillDescription GetSkillDescription()
Definition:
InstantKill.cpp:16
RobotAPI
components
skills
SkillProviderExample
InstantKill.cpp
Generated on Sat Oct 12 2024 09:14:06 for armarx_documentation by
1.8.17