HelloWorld.cpp
Go to the documentation of this file.
1#include "HelloWorld.h"
2
3#include <IceUtil/Time.h>
4
8
9#include <RobotAPI/components/skills/SkillProviderExample/aron/HelloWorldAcceptedType.aron.generated.h>
18
20{
22 SimpleSpecializedSkill<skills::Example::HelloWorldAcceptedType>(GetSkillDescription())
23 {
24 }
25
28 {
29 armarx::skills::Example::HelloWorldAcceptedType root_profile_params;
30 root_profile_params.some_float = 5;
31 root_profile_params.some_int = 42;
32 root_profile_params.some_text = "YOLO";
33 root_profile_params.some_optional_text = "OPTIONAL";
34 root_profile_params.some_list_of_matrices.push_back(Eigen::Matrix3f::Zero());
35 root_profile_params.some_matrix = Eigen::Matrix3f::Zero();
36
37 return SkillDescription{
38 .skillId = skills::SkillID{.skillName = "HelloWorld"},
39 .description = "This skill logs a message on ARMARX_IMPORTANT",
40 .rootProfileDefaults = root_profile_params.toAron(),
42 .parametersType = armarx::skills::Example::HelloWorldAcceptedType::ToAronType(),
43 .resultType = armarx::skills::Example::HelloWorldAcceptedType::ToAronType()};
44 }
45
47 HelloWorldSkill::init(const SpecializedInitInput& /*in*/)
48 {
49 ARMARX_INFO << "Hello from the init function.";
50
52 }
53
54 Skill::MainResult
55 HelloWorldSkill::main(const SpecializedMainInput& in)
56 {
57 ARMARX_IMPORTANT << "Hi, from the Hello World Skill.\n"
58 << "I received the following data: \n"
60 in.parameters.toAron())
61 .dump(2)
62 << "\n"
63 << "(executed at: " << IceUtil::Time::now() << ")";
64
65 return {TerminatedSkillStatus::Succeeded, in.parameters.toAron()};
66 }
67} // namespace armarx::skills::provider
static nlohmann::json ConvertToNlohmannJSON(const data::VariantPtr &)
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition Duration.cpp:48
virtual InitResult init()
Override this method with the actual implementation.
Definition Skill.cpp:519
virtual MainResult main()
Override this method with the actual implementation.
Definition Skill.cpp:542
static SkillDescription GetSkillDescription()
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
Definition Logging.h:190
This file is part of ArmarX.
A result struct for skill initialization.
Definition Skill.h:50