Recursive.cpp
Go to the documentation of this file.
1
#include "
Recursive.h
"
2
3
#include "
RobotAPI/libraries/skills/core/SkillDescription.h
"
4
5
namespace
armarx::skills::provider
6
{
7
8
RecursiveSkill::RecursiveSkill
() :
9
SimpleSpecializedSkill
<
skills
::Example::RecursiveSkillParams>(GetSkillDescription())
10
{
11
}
12
13
SkillDescription
14
RecursiveSkill::GetSkillDescription
()
15
{
16
armarx::skills::Example::RecursiveSkillParams root_profile_params;
17
root_profile_params.n = 10;
18
19
return
SkillDescription
{
20
.
skillId
=
skills::SkillID
{.
skillName
=
"Recursive"
},
21
.description =
"This skill calls itself recursively {n} times"
,
22
.rootProfileDefaults = root_profile_params.toAron(),
23
.timeout =
armarx::core::time::Duration::MilliSeconds
(10000),
24
.parametersType = armarx::skills::Example::RecursiveSkillParams::ToAronType(),
25
.resultType = armarx::skills::Example::RecursiveSkillParams::ToAronType()};
26
}
27
28
Skill::MainResult
29
RecursiveSkill::main
(
const
SpecializedMainInput& in)
30
{
31
const
int
n = in.parameters.n;
32
33
if
(n > 0)
34
{
35
SkillProxy
prx(
36
manager
,
37
skills::SkillID
{.
providerId
= *
getSkillId
().
providerId
, .skillName =
"Recursive"
});
38
39
armarx::skills::Example::RecursiveSkillParams params;
40
params.n = n - 1;
41
42
std::this_thread::sleep_for(std::chrono::milliseconds(100));
43
44
callSubskill
(prx, params.toAron());
45
}
46
47
throwIfSkillShouldTerminate
();
48
49
return
{
TerminatedSkillStatus::Succeeded
,
nullptr
};
50
}
51
}
// namespace armarx::skills::provider
armarx::skills::Skill::manager
manager::dti::SkillManagerInterfacePrx manager
Definition:
Skill.h:291
armarx::skills::provider::RecursiveSkill::RecursiveSkill
RecursiveSkill()
Definition:
Recursive.cpp:8
armarx::skills::TerminatedSkillStatus::Succeeded
@ Succeeded
skills
This file is part of ArmarX.
armarx::skills::SkillID::skillName
std::string skillName
Definition:
SkillID.h:41
armarx::skills::SkillDescription
Definition:
SkillDescription.h:17
armarx::skills::SkillID::providerId
std::optional< ProviderID > providerId
Definition:
SkillID.h:40
armarx::skills::Skill::callSubskill
std::optional< TerminatedSkillStatusUpdate > callSubskill(const skills::SkillProxy &proxy)
Call a subskill with default parameters and block until the subskill terminates.
Definition:
Skill.cpp:32
armarx::skills::SkillProxy
Definition:
SkillProxy.h:13
Recursive.h
armarx::skills::provider::RecursiveSkill::GetSkillDescription
static SkillDescription GetSkillDescription()
Definition:
Recursive.cpp:14
armarx::skills::SkillDescription::skillId
SkillID skillId
Definition:
SkillDescription.h:19
armarx::skills::SimpleSpecializedSkill
Definition:
SimpleSpecializedSkill.h:10
armarx::skills::provider
Definition:
BusyWaiting.cpp:6
armarx::skills::Skill::MainResult
A result struct for th main method of a skill.
Definition:
Skill.h:39
armarx::skills::SimpleSpecializedSkill< skills::Example::RecursiveSkillParams >::main
Skill::MainResult main() final
Definition:
SimpleSpecializedSkill.h:71
armarx::skills::Skill::throwIfSkillShouldTerminate
void throwIfSkillShouldTerminate(const std::string &abortedMessage="")
Definition:
Skill.cpp:305
armarx::skills::SkillID
Definition:
SkillID.h:14
armarx::skills::Skill::getSkillId
SkillID getSkillId() const
Get the id of the skill.
Definition:
Skill.cpp:497
armarx::core::time::Duration::MilliSeconds
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition:
Duration.cpp:48
SkillDescription.h
RobotAPI
components
skills
SkillProviderExample
Recursive.cpp
Generated on Sat Mar 29 2025 09:17:26 for armarx_documentation by
1.8.17