diff --git a/source/RobotAPI/libraries/skills/core/CMakeLists.txt b/source/RobotAPI/libraries/skills/core/CMakeLists.txt index f757e4b5d8d069673c67d39e8b559250202d6c03..7e5a56debc7b98c758991bf6e3d389672f92b483 100644 --- a/source/RobotAPI/libraries/skills/core/CMakeLists.txt +++ b/source/RobotAPI/libraries/skills/core/CMakeLists.txt @@ -23,8 +23,6 @@ armarx_add_library( SkillExecutionRequest.cpp SkillStatusUpdate.cpp SkillExecutionID.cpp - SkillPreparationInput.cpp - SkillParameterization.cpp Skill.cpp SkillProxy.cpp SkillDescription.cpp @@ -36,8 +34,6 @@ armarx_add_library( SkillExecutionRequest.h SkillStatusUpdate.h SkillExecutionID.h - SkillPreparationInput.h - SkillParameterization.h Skill.h SkillProxy.h SkillDescription.h diff --git a/source/RobotAPI/libraries/skills/core/ProviderID.h b/source/RobotAPI/libraries/skills/core/ProviderID.h index 5687f649185fa472d0afe1b7a60e6eb2eba46d34..d7710d96e3a6a65de86c0b1c4634f0c84220c8a0 100644 --- a/source/RobotAPI/libraries/skills/core/ProviderID.h +++ b/source/RobotAPI/libraries/skills/core/ProviderID.h @@ -1,10 +1,7 @@ #pragma once -#include <string> -#include <vector> #include <RobotAPI/interface/skills/SkillManagerInterface.h> -#include <RobotAPI/libraries/aron/core/data/variant/container/Dict.h> namespace armarx { diff --git a/source/RobotAPI/libraries/skills/core/ProviderInfo.h b/source/RobotAPI/libraries/skills/core/ProviderInfo.h index 438a2cf9d894f25f97150dc10ab6c5d9538cdc1e..b4a9c0470f017b1b21d43f70674ca1ab64afc556 100644 --- a/source/RobotAPI/libraries/skills/core/ProviderInfo.h +++ b/source/RobotAPI/libraries/skills/core/ProviderInfo.h @@ -1,16 +1,8 @@ #pragma once -#include <string> -#include <vector> -#include <SimoxUtility/algorithm/string.h> - -#include <RobotAPI/interface/skills/SkillManagerInterface.h> - -#include "ProviderID.h" -#include "SkillDescription.h" -#include "SkillID.h" -#include "error/Exception.h" +#include <RobotAPI/libraries/skills/core/ProviderID.h> +#include <RobotAPI/libraries/skills/core/SkillDescription.h> namespace armarx { diff --git a/source/RobotAPI/libraries/skills/core/Skill.cpp b/source/RobotAPI/libraries/skills/core/Skill.cpp index cf6c57f98d8970194c2f362dcfa122bb19c183a0..3a279a8b8e28bb2d7e01eb5ac5b17958c5b5ed51 100644 --- a/source/RobotAPI/libraries/skills/core/Skill.cpp +++ b/source/RobotAPI/libraries/skills/core/Skill.cpp @@ -1,4 +1,5 @@ #include "Skill.h" +#include <ArmarXCore/core/time/Metronome.h> #include <RobotAPI/libraries/skills/core/error/Exception.h> @@ -450,5 +451,46 @@ namespace armarx << "'. Please overwrite this method."; return {.status = TerminatedSkillStatus::Succeeded, .data = nullptr}; } + + void + Skill::setProviderId(const skills::ProviderID& pid) + { + description.skillId.providerId = pid; + } + + void + Skill::setCallback(const CallbackT& callback) + { + this->callback = callback; + } + + void + Skill::setManager(const manager::dti::SkillManagerInterfacePrx& manager) + { + this->manager = manager; + } + + void + Skill::setExecutorName(const std::string& executorName) + { + this->executorName = executorName; + } + + SkillDescription + Skill::getSkillDescription() const + { + return description; + } + + SkillID + Skill::getSkillId() const + { + return description.skillId; + } + + Skill::~Skill() + { + //ARMARX_IMPORTANT << "DESTROY SKILL " << getSkillId(); + } } // namespace skills } // namespace armarx diff --git a/source/RobotAPI/libraries/skills/core/Skill.h b/source/RobotAPI/libraries/skills/core/Skill.h index d9edf529c300968b4b428066836ba106a39e76e8..9be47862810009ec00fb8e9b8138b9ac1e0d5df0 100644 --- a/source/RobotAPI/libraries/skills/core/Skill.h +++ b/source/RobotAPI/libraries/skills/core/Skill.h @@ -4,17 +4,12 @@ #include <mutex> #include <thread> -#include <ArmarXCore/core/logging/Logging.h> -#include <ArmarXCore/core/time/DateTime.h> -#include <ArmarXCore/core/time/Metronome.h> +#include <ArmarXCore/core/time/Frequency.h> -#include <RobotAPI/interface/skills/SkillManagerInterface.h> -#include <RobotAPI/libraries/aron/core/data/variant/All.h> +#include <RobotAPI/libraries/skills/core/SkillDescription.h> +#include <RobotAPI/libraries/skills/core/SkillProxy.h> +#include <RobotAPI/libraries/skills/core/SkillStatusUpdate.h> -#include "SkillDescription.h" -#include "SkillID.h" -#include "SkillProxy.h" -#include "SkillStatusUpdate.h" namespace armarx { @@ -61,50 +56,23 @@ namespace armarx Skill(const SkillDescription&); /// Virtual destructor of a skill - virtual ~Skill() - { - //ARMARX_IMPORTANT << "DESTROY SKILL " << getSkillId(); - } + virtual ~Skill(); /// Get the id of the skill - SkillID - getSkillId() const - { - return description.skillId; - } + SkillID getSkillId() const; /// Get the description of a skill - SkillDescription - getSkillDescription() const - { - return description; - } + SkillDescription getSkillDescription() const; /// Set the provider id of the description of the skill. /// This method is called when creating a skill in a skill provider - void - setProviderId(const skills::ProviderID& pid) - { - description.skillId.providerId = pid; - } + void setProviderId(const skills::ProviderID& pid); - void - setCallback(const CallbackT& callback) - { - this->callback = callback; - } + void setCallback(const CallbackT& callback); - void - setManager(const manager::dti::SkillManagerInterfacePrx& manager) - { - this->manager = manager; - } + void setManager(const manager::dti::SkillManagerInterfacePrx& manager); - void - setExecutorName(const std::string& executorName) - { - this->executorName = executorName; - } + void setExecutorName(const std::string& executorName); /// Prepare a skill once. This method is called in a loop as long as it returns RUNNING /// If the loop does not terminate with SUCCEDED the skill execution is failed. diff --git a/source/RobotAPI/libraries/skills/core/SkillDescription.cpp b/source/RobotAPI/libraries/skills/core/SkillDescription.cpp index 2fa37b33ceab97b944e55644c99c530ba3f371c3..c7d5222e45de9215208c4d5547c50c4e367d3768 100644 --- a/source/RobotAPI/libraries/skills/core/SkillDescription.cpp +++ b/source/RobotAPI/libraries/skills/core/SkillDescription.cpp @@ -65,5 +65,14 @@ namespace armarx .parametersType = armarx::aron::type::Object::FromAronObjectDTO(i.parametersType), .resultType = armarx::aron::type::Object::FromAronObjectDTO(i.resultType)}; } + + bool + SkillDescription::operator==(const SkillDescription& other) const + { + return this->skillId == other.skillId && this->description == other.description && + this->rootProfileDefaults == other.rootProfileDefaults && + this->timeout == other.timeout && this->parametersType == other.parametersType && + this->resultType == other.resultType; + } } // namespace skills } // namespace armarx diff --git a/source/RobotAPI/libraries/skills/core/SkillDescription.h b/source/RobotAPI/libraries/skills/core/SkillDescription.h index f65ba3f45e5da2c36c223c79797bb3b27ac52450..a6f33333fb733c3ccafd6320bd03db5e89153101 100644 --- a/source/RobotAPI/libraries/skills/core/SkillDescription.h +++ b/source/RobotAPI/libraries/skills/core/SkillDescription.h @@ -30,15 +30,7 @@ namespace armarx const std::optional<ProviderID>& = std::nullopt); static SkillDescription FromIce(const manager::dto::SkillDescription& i); - bool - operator==(const SkillDescription& other) const - { - return this->skillId == other.skillId && this->description == other.description && - this->rootProfileDefaults == other.rootProfileDefaults && - this->timeout == other.timeout && - this->parametersType == other.parametersType && - this->resultType == other.resultType; - } + bool operator==(const SkillDescription& other) const; }; template <class T> diff --git a/source/RobotAPI/libraries/skills/core/SkillExecutionID.cpp b/source/RobotAPI/libraries/skills/core/SkillExecutionID.cpp index 2bf5f3235ba19f60f4475e9fe3d126fbcfec1db9..b93ef522c7d604e2fd43870da541d4d59d74e122 100644 --- a/source/RobotAPI/libraries/skills/core/SkillExecutionID.cpp +++ b/source/RobotAPI/libraries/skills/core/SkillExecutionID.cpp @@ -1,5 +1,7 @@ #include "SkillExecutionID.h" +#include <ArmarXCore/core/time/ice_conversions.h> + namespace armarx { namespace skills @@ -51,5 +53,22 @@ namespace armarx executionStartedTime.toDateTimeString() + EXIT_SEPARATOR; } + bool + SkillExecutionID::operator<=(const SkillExecutionID& other) const + { + return this->executionStartedTime <= other.executionStartedTime; + } + + bool + SkillExecutionID::operator<(const SkillExecutionID& other) const + { + return this->executionStartedTime < other.executionStartedTime; + } + + bool + SkillExecutionID::operator==(const SkillExecutionID& other) const + { + return this->toString() == other.toString(); + } } // namespace skills } // namespace armarx diff --git a/source/RobotAPI/libraries/skills/core/SkillExecutionID.h b/source/RobotAPI/libraries/skills/core/SkillExecutionID.h index 39f3bc008324d046486d4eb1cd486ef87a1860f8..7a7d5e9e1efccf43f7dfcb3f4dce4d4655c0f395 100644 --- a/source/RobotAPI/libraries/skills/core/SkillExecutionID.h +++ b/source/RobotAPI/libraries/skills/core/SkillExecutionID.h @@ -1,16 +1,12 @@ #pragma once #include <string> -#include <vector> #include <ArmarXCore/core/time/DateTime.h> -#include <ArmarXCore/core/time/ice_conversions.h> #include <RobotAPI/interface/skills/SkillProviderInterface.h> #include <RobotAPI/libraries/aron/core/data/variant/container/Dict.h> - -#include "SkillID.h" -#include "SkillParameterization.h" +#include <RobotAPI/libraries/skills/core/SkillID.h> namespace armarx { @@ -27,23 +23,11 @@ namespace armarx static const constexpr char* EXIT_SEPARATOR = "]"; static const constexpr char* SEPARATOR = "@"; - bool - operator==(const SkillExecutionID& other) const - { - return this->toString() == other.toString(); - } - - bool - operator<(const SkillExecutionID& other) const - { - return this->executionStartedTime < other.executionStartedTime; - } - - bool - operator<=(const SkillExecutionID& other) const - { - return this->executionStartedTime <= other.executionStartedTime; - } + bool operator==(const SkillExecutionID& other) const; + + bool operator<(const SkillExecutionID& other) const; + + bool operator<=(const SkillExecutionID& other) const; skills::manager::dto::SkillExecutionID toManagerIce() const; diff --git a/source/RobotAPI/libraries/skills/core/SkillExecutionRequest.h b/source/RobotAPI/libraries/skills/core/SkillExecutionRequest.h index d1f5bbcdd175f9f3516d45856186d453af2f987e..453291831f7e8e5c53d45855c51c81e04e011c70 100644 --- a/source/RobotAPI/libraries/skills/core/SkillExecutionRequest.h +++ b/source/RobotAPI/libraries/skills/core/SkillExecutionRequest.h @@ -1,18 +1,10 @@ #pragma once -#include <string> -#include <vector> - -#include <SimoxUtility/algorithm/string.h> - -#include <ArmarXCore/core/time/DateTime.h> -#include <ArmarXCore/core/time/ice_conversions.h> - #include <RobotAPI/interface/skills/SkillManagerInterface.h> +#include <RobotAPI/interface/skills/SkillProviderInterface.h> #include <RobotAPI/libraries/aron/core/data/variant/container/Dict.h> - -#include "SkillID.h" -#include "error/Exception.h" +#include <RobotAPI/libraries/skills/core/ProviderID.h> +#include <RobotAPI/libraries/skills/core/SkillID.h> namespace armarx { diff --git a/source/RobotAPI/libraries/skills/core/SkillID.cpp b/source/RobotAPI/libraries/skills/core/SkillID.cpp index 2bf5cb5596a89a8daab37ef8e957a8c9fcc2b532..87fa6cd75b4faf144e593f7d5702b893aa9dab4c 100644 --- a/source/RobotAPI/libraries/skills/core/SkillID.cpp +++ b/source/RobotAPI/libraries/skills/core/SkillID.cpp @@ -1,5 +1,9 @@ #include "SkillID.h" +#include <optional> + +#include <ArmarXCore/core/exceptions/local/ExpressionException.h> + namespace armarx { namespace skills @@ -69,6 +73,28 @@ namespace armarx } return NAME_SEPARATOR + skillName; } + + bool + SkillID::isFullySpecified() const + { + return isSkillSpecified() and isProviderSpecified(); + } + + bool + SkillID::isSkillSpecified() const + { + return not skillName.empty(); + } + + bool + SkillID::isProviderSpecified() const + { + if (not providerId.has_value()) + { + return false; + } + return not providerId->providerName.empty(); + } } // namespace skills std::ostream& diff --git a/source/RobotAPI/libraries/skills/core/SkillID.h b/source/RobotAPI/libraries/skills/core/SkillID.h index 8bf5eb0f34a4a73ef8255f1ac64e1222ca71692d..1de4e5fc764d10bb5af2324f02ce4f71b81b60ef 100644 --- a/source/RobotAPI/libraries/skills/core/SkillID.h +++ b/source/RobotAPI/libraries/skills/core/SkillID.h @@ -1,8 +1,7 @@ #pragma once #include <string> - -#include <SimoxUtility/algorithm/string.h> +#include <optional> #include <RobotAPI/interface/skills/SkillManagerInterface.h> @@ -23,27 +22,11 @@ namespace armarx bool operator<(const SkillID& other) const; bool operator<=(const SkillID& other) const; - bool - isFullySpecified() const - { - return isSkillSpecified() and isProviderSpecified(); - } - - bool - isSkillSpecified() const - { - return not skillName.empty(); - } - - bool - isProviderSpecified() const - { - if (not providerId.has_value()) - { - return false; - } - return not providerId->providerName.empty(); - } + bool isFullySpecified() const; + + bool isSkillSpecified() const; + + bool isProviderSpecified() const; manager::dto::SkillID toManagerIce() const; provider::dto::SkillID toProviderIce() const; diff --git a/source/RobotAPI/libraries/skills/core/SkillParameterization.cpp b/source/RobotAPI/libraries/skills/core/SkillParameterization.cpp deleted file mode 100644 index d0ec681e2b772aa773a6cc890198e24c28714207..0000000000000000000000000000000000000000 --- a/source/RobotAPI/libraries/skills/core/SkillParameterization.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "SkillParameterization.h" - -namespace armarx -{ - namespace skills - { - } -} // namespace armarx diff --git a/source/RobotAPI/libraries/skills/core/SkillParameterization.h b/source/RobotAPI/libraries/skills/core/SkillParameterization.h deleted file mode 100644 index 9b54b3fff3bfe0aaedcb79d9c275165aefe5a37d..0000000000000000000000000000000000000000 --- a/source/RobotAPI/libraries/skills/core/SkillParameterization.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include <string> -#include <vector> - -#include <RobotAPI/interface/skills/SkillProviderInterface.h> -#include <RobotAPI/libraries/aron/core/data/variant/container/Dict.h> - -namespace armarx -{ - namespace skills - { - } // namespace skills -} // namespace armarx diff --git a/source/RobotAPI/libraries/skills/core/SkillPreparationInput.cpp b/source/RobotAPI/libraries/skills/core/SkillPreparationInput.cpp deleted file mode 100644 index d0ec681e2b772aa773a6cc890198e24c28714207..0000000000000000000000000000000000000000 --- a/source/RobotAPI/libraries/skills/core/SkillPreparationInput.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "SkillParameterization.h" - -namespace armarx -{ - namespace skills - { - } -} // namespace armarx diff --git a/source/RobotAPI/libraries/skills/core/SkillPreparationInput.h b/source/RobotAPI/libraries/skills/core/SkillPreparationInput.h deleted file mode 100644 index b5cc2bb20c392864ccb31607e1ef02e9174fb211..0000000000000000000000000000000000000000 --- a/source/RobotAPI/libraries/skills/core/SkillPreparationInput.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include <string> -#include <vector> - -#include <RobotAPI/interface/skills/SkillProviderInterface.h> -#include <RobotAPI/libraries/aron/core/data/variant/container/Dict.h> - -namespace armarx -{ - namespace skills - { - - } // namespace skills -} // namespace armarx diff --git a/source/RobotAPI/libraries/skills/core/SkillStatusUpdate.cpp b/source/RobotAPI/libraries/skills/core/SkillStatusUpdate.cpp index 8e5ade1866d4d71a389443c1b5ce1fc48485e9ea..2f57db3940b0d622650565951ccc04e8950d2277 100644 --- a/source/RobotAPI/libraries/skills/core/SkillStatusUpdate.cpp +++ b/source/RobotAPI/libraries/skills/core/SkillStatusUpdate.cpp @@ -406,5 +406,103 @@ namespace armarx return ret; } + bool + SkillStatusUpdate::operator<(const SkillStatusUpdate& o) const + { + if (!hasBeenConstructed() and o.hasBeenConstructed()) + { + return true; + } + if (!hasBeenInitialized() and o.hasBeenInitialized()) + { + return true; + } + if (!hasBeenPrepared() and o.hasBeenPrepared()) + { + return true; + } + if (!hasBeenRunning() and o.hasBeenRunning()) + { + return true; + } + if (!hasBeenTerminated() and o.hasBeenTerminated()) + { + return true; + } + return false; + } + + bool + SkillStatusUpdate::operator<=(const SkillStatusUpdate& o) const + { + if (status == o.status) + { + return true; + } + return *this < o; + } + + bool + SkillStatusUpdate::hasBeenConstructed() const + { + return status != SkillStatus::Constructing; + } + + bool + SkillStatusUpdate::hasBeenInitialized() const + { + return status != SkillStatus::Initializing && hasBeenConstructed(); + } + + bool + SkillStatusUpdate::hasBeenPrepared() const + { + return status != SkillStatus::Preparing && hasBeenInitialized(); + } + + bool + SkillStatusUpdate::hasBeenRunning() const + { + return status != SkillStatus::Running || hasBeenPrepared(); + } + + bool + SkillStatusUpdate::hasBeenTerminated() const + { + return status == SkillStatus::Succeeded || status == SkillStatus::Failed || + status == SkillStatus::Aborted; + } + + bool + SkillStatusUpdate::hasBeenSucceeded() const + { + return status == SkillStatus::Succeeded; + } + + bool + ActiveOrTerminatedSkillStatusUpdate::hasBeenTerminated() const + { + return status == ActiveOrTerminatedSkillStatus::Succeeded || + status == ActiveOrTerminatedSkillStatus::Failed || + status == ActiveOrTerminatedSkillStatus::Aborted; + } + + bool + ActiveOrTerminatedSkillStatusUpdate::hasBeenSucceeded() const + { + return status == ActiveOrTerminatedSkillStatus::Succeeded; + } + + bool + TerminatedSkillStatusUpdate::hasBeenTerminated() const + { + return true; + } + + bool + TerminatedSkillStatusUpdate::hasBeenSucceeded() const + { + return status == TerminatedSkillStatus::Succeeded; + } } // namespace skills } // namespace armarx diff --git a/source/RobotAPI/libraries/skills/core/SkillStatusUpdate.h b/source/RobotAPI/libraries/skills/core/SkillStatusUpdate.h index f6318d5c1993fd94d17a6a5e5e16086794d1f34d..4ce5cba6afad707bac55c6155b64cb44115819b7 100644 --- a/source/RobotAPI/libraries/skills/core/SkillStatusUpdate.h +++ b/source/RobotAPI/libraries/skills/core/SkillStatusUpdate.h @@ -75,17 +75,9 @@ namespace armarx { TerminatedSkillStatus status = TerminatedSkillStatus::Failed; - bool - hasBeenTerminated() const - { - return true; - } - - bool - hasBeenSucceeded() const - { - return status == TerminatedSkillStatus::Succeeded; - } + bool hasBeenTerminated() const; + + bool hasBeenSucceeded() const; manager::dto::SkillStatusUpdate toManagerIce() const; @@ -104,19 +96,9 @@ namespace armarx { ActiveOrTerminatedSkillStatus status = ActiveOrTerminatedSkillStatus::Failed; - bool - hasBeenTerminated() const - { - return status == ActiveOrTerminatedSkillStatus::Succeeded || - status == ActiveOrTerminatedSkillStatus::Failed || - status == ActiveOrTerminatedSkillStatus::Aborted; - } + bool hasBeenTerminated() const; - bool - hasBeenSucceeded() const - { - return status == ActiveOrTerminatedSkillStatus::Succeeded; - } + bool hasBeenSucceeded() const; manager::dto::SkillStatusUpdate toManagerIce() const; @@ -135,78 +117,21 @@ namespace armarx { SkillStatus status = SkillStatus::Constructing; - bool - operator<(const SkillStatusUpdate& o) const - { - if (!hasBeenConstructed() and o.hasBeenConstructed()) - { - return true; - } - if (!hasBeenInitialized() and o.hasBeenInitialized()) - { - return true; - } - if (!hasBeenPrepared() and o.hasBeenPrepared()) - { - return true; - } - if (!hasBeenRunning() and o.hasBeenRunning()) - { - return true; - } - if (!hasBeenTerminated() and o.hasBeenTerminated()) - { - return true; - } - return false; - } - - bool - operator<=(const SkillStatusUpdate& o) const - { - if (status == o.status) - { - return true; - } - return *this < o; - } - - bool - hasBeenConstructed() const - { - return status != SkillStatus::Constructing; - } - - bool - hasBeenInitialized() const - { - return status != SkillStatus::Initializing && hasBeenConstructed(); - } - - bool - hasBeenPrepared() const - { - return status != SkillStatus::Preparing && hasBeenInitialized(); - } - - bool - hasBeenRunning() const - { - return status != SkillStatus::Running || hasBeenPrepared(); - } - - bool - hasBeenTerminated() const - { - return status == SkillStatus::Succeeded || status == SkillStatus::Failed || - status == SkillStatus::Aborted; - } - - bool - hasBeenSucceeded() const - { - return status == SkillStatus::Succeeded; - } + bool operator<(const SkillStatusUpdate& o) const; + + bool operator<=(const SkillStatusUpdate& o) const; + + bool hasBeenConstructed() const; + + bool hasBeenInitialized() const; + + bool hasBeenPrepared() const; + + bool hasBeenRunning() const; + + bool hasBeenTerminated() const; + + bool hasBeenSucceeded() const; manager::dto::SkillStatusUpdate toManagerIce() const; diff --git a/source/RobotAPI/libraries/skills/core/error/Exception.cpp b/source/RobotAPI/libraries/skills/core/error/Exception.cpp index 32521fedeb0428e384897ce88e2f9f42ebb57a71..c2668867df8b5f5e5ea0f703582f0c92f14c4587 100644 --- a/source/RobotAPI/libraries/skills/core/error/Exception.cpp +++ b/source/RobotAPI/libraries/skills/core/error/Exception.cpp @@ -1,2 +1,33 @@ #include "Exception.h" + +armarx::skills::error::SkillException::SkillException(const std::string& prettymethod, + const std::string& reason) : + LocalException(prettymethod + ": " + reason + ".") +{ +} + +armarx::skills::error::SkillNotFoundException::SkillNotFoundException( + const std::string& prettymethod, + const std::string& reason) : + SkillException(prettymethod, reason) +{ +} + +armarx::skills::error::SkillAbortedException::SkillAbortedException(const std::string& prettymethod, + const std::string& reason) : + SkillException(prettymethod, reason) +{ +} + +armarx::skills::error::SkillFailedException::SkillFailedException(const std::string& prettymethod, + const std::string& reason) : + SkillException(prettymethod, reason) +{ +} + +armarx::skills::error::NotImplementedYetException::NotImplementedYetException( + const std::string& prettymethod) : + SkillException(prettymethod, "This method is not yet implemented!") +{ +} diff --git a/source/RobotAPI/libraries/skills/core/error/Exception.h b/source/RobotAPI/libraries/skills/core/error/Exception.h index d9107d8213b9d5d2b1e70f578ee7b376be0f102a..66e72e418d51ffb1555498741cf928d1e417e497 100644 --- a/source/RobotAPI/libraries/skills/core/error/Exception.h +++ b/source/RobotAPI/libraries/skills/core/error/Exception.h @@ -23,12 +23,10 @@ #pragma once -// STD/STL + #include <string> -// ArmarX -#include <ArmarXCore/core/exceptions/Exception.h> -#include <ArmarXCore/core/exceptions/local/ExpressionException.h> +#include <ArmarXCore/core/exceptions/LocalException.h> namespace armarx::skills::error { @@ -40,10 +38,7 @@ namespace armarx::skills::error public: SkillException() = delete; - SkillException(const std::string& prettymethod, const std::string& reason) : - LocalException(prettymethod + ": " + reason + ".") - { - } + SkillException(const std::string& prettymethod, const std::string& reason); }; /** @@ -54,10 +49,7 @@ namespace armarx::skills::error public: SkillNotFoundException() = delete; - SkillNotFoundException(const std::string& prettymethod, const std::string& reason) : - SkillException(prettymethod, reason) - { - } + SkillNotFoundException(const std::string& prettymethod, const std::string& reason); }; class SkillAbortedException : public SkillException @@ -65,10 +57,7 @@ namespace armarx::skills::error public: SkillAbortedException() = delete; - SkillAbortedException(const std::string& prettymethod, const std::string& reason) : - SkillException(prettymethod, reason) - { - } + SkillAbortedException(const std::string& prettymethod, const std::string& reason); }; class SkillFailedException : public SkillException @@ -76,10 +65,7 @@ namespace armarx::skills::error public: SkillFailedException() = delete; - SkillFailedException(const std::string& prettymethod, const std::string& reason) : - SkillException(prettymethod, reason) - { - } + SkillFailedException(const std::string& prettymethod, const std::string& reason); }; /** @@ -90,9 +76,6 @@ namespace armarx::skills::error public: NotImplementedYetException() = delete; - NotImplementedYetException(const std::string& prettymethod) : - SkillException(prettymethod, "This method is not yet implemented!") - { - } + NotImplementedYetException(const std::string& prettymethod); }; } // namespace armarx::skills::error diff --git a/source/RobotAPI/libraries/skills/provider/SimplePeriodicSkill.cpp b/source/RobotAPI/libraries/skills/provider/SimplePeriodicSkill.cpp index db3c05d511872e082bf4b2bb3a01a1293f7468af..68b1fb7e137bbf33045cc320100de697e7ab52e5 100644 --- a/source/RobotAPI/libraries/skills/provider/SimplePeriodicSkill.cpp +++ b/source/RobotAPI/libraries/skills/provider/SimplePeriodicSkill.cpp @@ -1,4 +1,5 @@ #include "SimplePeriodicSkill.h" +#include <ArmarXCore/core/time/Metronome.h> #include <RobotAPI/libraries/skills/core/error/Exception.h> diff --git a/source/RobotAPI/libraries/skills/provider/SimplePeriodicSpecializedSkill.h b/source/RobotAPI/libraries/skills/provider/SimplePeriodicSpecializedSkill.h index c0f8b7ebd23df0d41429b2e9c7ddd3a7b0f66e94..37d1e6084e81f99dd59973e9d22df022df509fb0 100644 --- a/source/RobotAPI/libraries/skills/provider/SimplePeriodicSpecializedSkill.h +++ b/source/RobotAPI/libraries/skills/provider/SimplePeriodicSpecializedSkill.h @@ -1,5 +1,6 @@ #pragma once +#include <ArmarXCore/core/time/Metronome.h> #include <RobotAPI/libraries/skills/core/error/Exception.h> #include "PeriodicSkill.h" #include "SimpleSpecializedSkill.h" diff --git a/source/RobotAPI/libraries/skills/provider/SkillProviderComponentPlugin.h b/source/RobotAPI/libraries/skills/provider/SkillProviderComponentPlugin.h index 858ee511de6fa042e257b202b6cee3bf94a446a1..21e0d6d97ecb7841237b4ed495355531c38d1972 100644 --- a/source/RobotAPI/libraries/skills/provider/SkillProviderComponentPlugin.h +++ b/source/RobotAPI/libraries/skills/provider/SkillProviderComponentPlugin.h @@ -1,11 +1,7 @@ #pragma once #include <experimental/memory> -#include <functional> -#include <queue> #include <shared_mutex> -#include <thread> -#include <type_traits> #include <ArmarXCore/core/ComponentPlugin.h> #include <ArmarXCore/core/ManagedIceObject.h> @@ -14,20 +10,13 @@ #include <RobotAPI/interface/skills/SkillManagerInterface.h> #include <RobotAPI/libraries/aron/core/data/variant/container/Dict.h> -// Include all types of skills #include <RobotAPI/libraries/skills/core/Skill.h> #include <RobotAPI/libraries/skills/core/SkillExecutionRequest.h> -#include <RobotAPI/libraries/skills/core/SkillPreparationInput.h> -#include "LambdaSkill.h" -#include "PeriodicSkill.h" -#include "PeriodicSpecializedSkill.h" -#include "SkillFactory.h" -#include "SpecializedSkill.h" - -// Helper wrapper for execution #include "detail/SkillImplementationWrapper.h" +#include "LambdaSkill.h" + namespace armarx { class SkillProviderComponentPluginUser; // forward declaration diff --git a/source/RobotAPI/libraries/skills/provider/blueprints/SkillWithContextBlueprint.h b/source/RobotAPI/libraries/skills/provider/blueprints/SkillWithContextBlueprint.h index db852e076274c6f8b479a25d4b7d65c474912fae..6a6802204822692867f0a9c5545359d4a0fc77bb 100644 --- a/source/RobotAPI/libraries/skills/provider/blueprints/SkillWithContextBlueprint.h +++ b/source/RobotAPI/libraries/skills/provider/blueprints/SkillWithContextBlueprint.h @@ -22,6 +22,8 @@ #pragma once +#include <atomic> + #include <RobotAPI/libraries/skills/provider/SkillFactory.h> namespace armarx @@ -79,4 +81,4 @@ namespace armarx ContextT context_; }; } // namespace skills -} // namespace armarx \ No newline at end of file +} // namespace armarx diff --git a/source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.cpp b/source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.cpp index 0e1515343b7cf9bf84daa949eb70d2035f35e751..35fc69ddd8a073f3b78ae008a67466dddc36ce68 100644 --- a/source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.cpp +++ b/source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.cpp @@ -4,6 +4,8 @@ #include <RobotAPI/libraries/aron/core/data/variant/container/Dict.h> #include <RobotAPI/libraries/skills/core/aron/SkillErrorResult.aron.generated.h> + + namespace armarx { namespace skills::detail diff --git a/source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.h b/source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.h index 935fa227bf13831d3bcc789a124b36d12f1ba423..8b3f51277fe351229dbbb4f00eab72655cc724ea 100644 --- a/source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.h +++ b/source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.h @@ -1,12 +1,10 @@ #pragma once #include <experimental/memory> -#include <shared_mutex> +#include <mutex> -#include <RobotAPI/interface/skills/SkillManagerInterface.h> -#include <RobotAPI/libraries/skills/core/Skill.h> -#include <RobotAPI/libraries/skills/core/SkillDescription.h> -#include <RobotAPI/libraries/skills/core/SkillPreparationInput.h> +#include <RobotAPI/interface/skills/SkillProviderInterface.h> +#include <RobotAPI/libraries/aron/core/data/variant/container/Dict.h> #include <RobotAPI/libraries/skills/core/SkillStatusUpdate.h> #include <RobotAPI/libraries/skills/provider/SkillFactory.h>