RandomExitStatus.cpp
Go to the documentation of this file.
1
2
#include "
RandomExitStatus.h
"
3
4
#include <
ArmarXCore/core/logging/Logging.h
>
5
6
namespace
armarx::skills::provider
7
{
8
RandomExitStatus::RandomExitStatus
() :
SimpleSkill
(GetSkillDescription())
9
{
10
}
11
12
SkillDescription
13
RandomExitStatus::GetSkillDescription
()
14
{
15
return
SkillDescription
{.
skillId
=
skills::SkillID
{.
skillName
=
"RandomExitStatus"
},
16
.description =
"This skill exits with a random status. It either "
17
"succeeds or fails with a 50/50 chance."
,
18
.rootProfileDefaults =
armarx::aron::make_dict
(),
19
.timeout =
armarx::core::time::Duration::MilliSeconds
(100)};
20
}
21
22
Skill::MainResult
23
RandomExitStatus::main
(
const
MainInput& in)
24
{
25
if
((rand() % 2) != 0)
26
{
27
return
{
TerminatedSkillStatus::Succeeded
,
nullptr
};
28
}
29
return
{
TerminatedSkillStatus::Failed
,
nullptr
};
30
}
31
}
// namespace armarx::skills::provider
armarx::skills::TerminatedSkillStatus::Succeeded
@ Succeeded
RandomExitStatus.h
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::SkillDescription::skillId
SkillID skillId
Definition:
SkillDescription.h:19
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::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::TerminatedSkillStatus::Failed
@ Failed
armarx::skills::provider::RandomExitStatus::RandomExitStatus
RandomExitStatus()
Definition:
RandomExitStatus.cpp:8
Logging.h
armarx::skills::SkillID
Definition:
SkillID.h:14
armarx::core::time::Duration::MilliSeconds
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition:
Duration.cpp:48
armarx::skills::provider::RandomExitStatus::GetSkillDescription
static SkillDescription GetSkillDescription()
Definition:
RandomExitStatus.cpp:13
RobotAPI
components
skills
SkillProviderExample
RandomExitStatus.cpp
Generated on Sat Mar 29 2025 09:17:26 for armarx_documentation by
1.8.17