diff --git a/source/RobotAPI/components/skills/SkillProviderExample/SkillProviderExample.cpp b/source/RobotAPI/components/skills/SkillProviderExample/SkillProviderExample.cpp index a183a100c1f177bd2b7de9970f3b4fbea524380a..4e82f6d7e1408170e7d992996cebcba7d56e7fbb 100644 --- a/source/RobotAPI/components/skills/SkillProviderExample/SkillProviderExample.cpp +++ b/source/RobotAPI/components/skills/SkillProviderExample/SkillProviderExample.cpp @@ -9,7 +9,8 @@ namespace armarx::skills::provider { - HelloWorldSkill::HelloWorldSkill() : Skill(GetSkillDescription()) + HelloWorldSkill::HelloWorldSkill() : + SimpleSpecializedSkill<skills::Example::HelloWorldAcceptedType>(GetSkillDescription()) { } @@ -21,7 +22,7 @@ namespace armarx::skills::provider root_profile_params.some_int = 42; root_profile_params.some_text = "YOLO"; root_profile_params.some_list_of_matrices.push_back(Eigen::Matrix3f::Zero()); - //default_params.some_matrix = Eigen::Matrix3f::Zero(); + root_profile_params.some_matrix = Eigen::Matrix3f::Zero(); return SkillDescription{{"HelloWorld"}, "This skill logs a message on ARMARX_IMPORTANT", @@ -31,12 +32,12 @@ namespace armarx::skills::provider } Skill::MainResult - HelloWorldSkill::main() + HelloWorldSkill::main(const SpecializedMainInput& in) { ARMARX_IMPORTANT << "Hi, from the Hello World Skill.\n" << "I received the following data: \n" << aron::data::converter::AronNlohmannJSONConverter::ConvertToNlohmannJSON( - parameters) + in.parameters.toAron()) .dump(2) << "\n" << "Type fulfilled? " @@ -47,7 +48,7 @@ namespace armarx::skills::provider return {TerminatedSkillStatus::Succeeded, nullptr}; } - IncompleteSkill::IncompleteSkill() : Skill(GetSkillDescription()) + IncompleteSkill::IncompleteSkill() : SimpleSkill(GetSkillDescription()) { } @@ -86,14 +87,14 @@ namespace armarx::skills::provider } Skill::MainResult - IncompleteSkill::main() + IncompleteSkill::main(const MainInput& in) { auto s = HelloWorldSkill(); - s.setParameters(this->getParameters()); + s.setParameters(in.parameters); return s.mainOfSkill(); } - ChainingSkill::ChainingSkill() : Skill(GetSkillDescription()) + ChainingSkill::ChainingSkill() : SimpleSkill(GetSkillDescription()) { } @@ -108,7 +109,7 @@ namespace armarx::skills::provider } Skill::MainResult - ChainingSkill::main() + ChainingSkill::main(const MainInput& in) { armarx::skills::Example::HelloWorldAcceptedType exec1; armarx::skills::Example::HelloWorldAcceptedType exec2; @@ -152,7 +153,7 @@ namespace armarx::skills::provider return {ActiveOrTerminatedSkillStatus::Running, nullptr}; } - CallbackSkill::CallbackSkill() : Skill(GetSkillDescription()) + CallbackSkill::CallbackSkill() : SimpleSkill(GetSkillDescription()) { } @@ -167,21 +168,21 @@ namespace armarx::skills::provider } Skill::MainResult - CallbackSkill::main() + CallbackSkill::main(const MainInput& in) { ARMARX_IMPORTANT << "Logging three updates via the callback"; auto up1 = std::make_shared<aron::data::Dict>(); up1->addElement("updateInfo", std::make_shared<aron::data::String>("Update 1")); - this->callback(skills::SkillStatus::Running, up1); + in.callback(skills::SkillStatus::Running, up1); auto up2 = std::make_shared<aron::data::Dict>(); up2->addElement("updateInfo", std::make_shared<aron::data::String>("Update 2")); - this->callback(skills::SkillStatus::Running, up2); + in.callback(skills::SkillStatus::Running, up2); auto up3 = std::make_shared<aron::data::Dict>(); up3->addElement("updateInfo", std::make_shared<aron::data::String>("Update 3")); - this->callback(skills::SkillStatus::Running, up3); + in.callback(skills::SkillStatus::Running, up3); return {TerminatedSkillStatus::Succeeded, nullptr}; } diff --git a/source/RobotAPI/components/skills/SkillProviderExample/SkillProviderExample.h b/source/RobotAPI/components/skills/SkillProviderExample/SkillProviderExample.h index 190dc56a203e42aadac9f0fc483aed264fdc0685..24d607450191b6ab98f3ba45112a417337358308 100644 --- a/source/RobotAPI/components/skills/SkillProviderExample/SkillProviderExample.h +++ b/source/RobotAPI/components/skills/SkillProviderExample/SkillProviderExample.h @@ -27,13 +27,16 @@ #include <ArmarXCore/core/Component.h> // RobotAPI +#include <RobotAPI/components/skills/SkillProviderExample/aron/HelloWorldAcceptedType.aron.generated.h> +#include <RobotAPI/libraries/skills/provider/SimpleSkill.h> +#include <RobotAPI/libraries/skills/provider/SimpleSpecializedSkill.h> #include <RobotAPI/libraries/skills/provider/SkillProviderComponentPlugin.h> #include <RobotAPI/libraries/skills/provider/SkillProxy.h> namespace armarx::skills::provider { // Skills: - class HelloWorldSkill : public Skill + class HelloWorldSkill : public SimpleSpecializedSkill<skills::Example::HelloWorldAcceptedType> { public: HelloWorldSkill(); @@ -41,10 +44,10 @@ namespace armarx::skills::provider static SkillDescription GetSkillDescription(); private: - Skill::MainResult main() final; + Skill::MainResult main(const SpecializedMainInput& in) final; }; - class IncompleteSkill : public Skill + class IncompleteSkill : public SimpleSkill { public: IncompleteSkill(); @@ -53,12 +56,12 @@ namespace armarx::skills::provider private: Skill::PrepareResult prepare() final; - Skill::MainResult main() final; + Skill::MainResult main(const MainInput&) final; std::atomic_bool first_prepared = false; }; - class ChainingSkill : public Skill + class ChainingSkill : public SimpleSkill { public: ChainingSkill(); @@ -66,7 +69,7 @@ namespace armarx::skills::provider static SkillDescription GetSkillDescription(); private: - Skill::MainResult main() final; + Skill::MainResult main(const MainInput&) final; }; class TimeoutSkill : public PeriodicSkill @@ -80,7 +83,7 @@ namespace armarx::skills::provider PeriodicSkill::StepResult step() final; }; - class CallbackSkill : public Skill + class CallbackSkill : public SimpleSkill { public: CallbackSkill(); @@ -88,7 +91,7 @@ namespace armarx::skills::provider static SkillDescription GetSkillDescription(); private: - Skill::MainResult main() final; + Skill::MainResult main(const MainInput&) final; }; /**