HelloWorld.cpp
Go to the documentation of this file.
1
2
3
#include "
HelloWorld.h
"
4
5
#include <
RobotAPI/libraries/aron/converter/json/NLohmannJSONConverter.h
>
6
#include <
RobotAPI/libraries/aron/core/type/variant/container/Object.h
>
7
#include <
RobotAPI/libraries/aron/core/type/variant/primitive/String.h
>
8
9
namespace
armarx::skills::provider
10
{
11
HelloWorldSkill::HelloWorldSkill
() :
12
SimpleSpecializedSkill
<
skills
::Example::HelloWorldAcceptedType>(GetSkillDescription())
13
{
14
}
15
16
SkillDescription
17
HelloWorldSkill::GetSkillDescription
()
18
{
19
armarx::skills::Example::HelloWorldAcceptedType root_profile_params;
20
root_profile_params.some_float = 5;
21
root_profile_params.some_int = 42;
22
root_profile_params.some_text =
"YOLO"
;
23
root_profile_params.some_optional_text =
"OPTIONAL"
;
24
root_profile_params.some_list_of_matrices.push_back(Eigen::Matrix3f::Zero());
25
root_profile_params.some_matrix = Eigen::Matrix3f::Zero();
26
27
return
SkillDescription
{.
skillId
=
skills::SkillID
{.
skillName
=
"HelloWorld"
},
28
.description =
"This skill logs a message on ARMARX_IMPORTANT"
,
29
.rootProfileDefaults = root_profile_params.toAron(),
30
.timeout =
armarx::core::time::Duration::MilliSeconds
(1000),
31
.parametersType =
32
armarx::skills::Example::HelloWorldAcceptedType::ToAronType(),
33
.resultType = armarx::skills::Example::HelloWorldAcceptedType::ToAronType()};
34
}
35
36
Skill::MainResult
37
HelloWorldSkill::main
(
const
SpecializedMainInput& in)
38
{
39
ARMARX_IMPORTANT
<<
"Hi, from the Hello World Skill.\n"
40
<<
"I received the following data: \n"
41
<<
aron::data::converter::AronNlohmannJSONConverter::ConvertToNlohmannJSON
(
42
in.parameters.toAron())
43
.dump(2)
44
<<
"\n"
45
<<
"(executed at: "
<< IceUtil::Time::now() <<
")"
;
46
return
{
TerminatedSkillStatus::Succeeded
, in.parameters.toAron()};
47
}
48
}
// namespace armarx::skills::provider
armarx::skills::TerminatedSkillStatus::Succeeded
@ Succeeded
skills
This file is part of ArmarX.
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition:
Logging.h:183
armarx::skills::SkillID::skillName
std::string skillName
Definition:
SkillID.h:60
armarx::skills::SkillDescription
Definition:
SkillDescription.h:18
armarx::aron::data::converter::AronNlohmannJSONConverter::ConvertToNlohmannJSON
static nlohmann::json ConvertToNlohmannJSON(const data::VariantPtr &)
Definition:
NLohmannJSONConverter.cpp:10
String.h
HelloWorld.h
NLohmannJSONConverter.h
Object.h
armarx::skills::SkillDescription::skillId
SkillID skillId
Definition:
SkillDescription.h:20
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:48
armarx::skills::SimpleSpecializedSkill< skills::Example::HelloWorldAcceptedType >::main
Skill::MainResult main() final
Definition:
SimpleSpecializedSkill.h:71
armarx::skills::provider::HelloWorldSkill::HelloWorldSkill
HelloWorldSkill()
Definition:
HelloWorld.cpp:11
armarx::skills::SkillID
Definition:
SkillID.h:17
armarx::core::time::Duration::MilliSeconds
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition:
Duration.cpp:55
armarx::skills::provider::HelloWorldSkill::GetSkillDescription
static SkillDescription GetSkillDescription()
Definition:
HelloWorld.cpp:17
RobotAPI
components
skills
SkillProviderExample
HelloWorld.cpp
Generated on Sat Oct 12 2024 09:14:06 for armarx_documentation by
1.8.17