9#include <IceUtil/Optional.h>
24#include <RobotAPI/interface/skills/SkillManagerInterface.h>
38 IceUtil::Optional<manager::dto::SkillDescription> description =
47 std::stringstream reason;
48 reason <<
"No skill with ID " << skillId <<
" found";
92 skills::manager::dto::SkillExecutionRequest req;
93 req.executorName = executorName;
97 auto terminatingUpdateIce =
manager->executeSkill(req);
106 skills::manager::dto::SkillExecutionRequest req;
107 req.executorName = executorName;
111 auto execIdIce =
manager->executeSkillAsync(req);
115 std::optional<TerminatedSkillStatusUpdate>
122 std::optional<TerminatedSkillStatusUpdate> ret = std::nullopt;
124 int const max_tries =
148 if (tries > max_tries)
151 <<
" does not seem to have been started "
152 "successfully after "
212 auto r =
manager->abortSkill(
id.toManagerIce());
220 auto r =
manager->abortSkillAsync(
id.toManagerIce());
230 std::optional<SkillStatusUpdate>
233 IceUtil::Optional<::armarx::skills::manager::dto::SkillStatusUpdate> statusUpdate =
236 if (not statusUpdate)
static data::dto::DictPtr ToAronDictDTO(const PointerType &navigator)
double toSecondsDouble() const
Returns the amount of seconds.
double toHertzDouble() const
Simple rate limiter for use in loops to maintain a certain frequency given a clock.
bool isFullySpecified() const
manager::dto::SkillID toManagerIce() const
TerminatedSkillStatusUpdate executeSkill(const std::string &executorName, const aron::data::DictPtr ¶ms=nullptr) const
execute a skill and block until skill terminates
SkillExecutionID executeSkillAsync(const std::string &executorName, const aron::data::DictPtr ¶ms=nullptr) const
execute a skill. Do not block during execution
SkillDescription skillDescription
std::optional< TerminatedSkillStatusUpdate > join(const SkillExecutionID &executionId, armarx::Duration max_wait_time=armarx::Duration::Seconds(1), armarx::Frequency check_frequency=armarx::Frequency::Hertz(20)) const
poll execution status and block until its null or terminated
manager::dti::SkillManagerInterfacePrx manager
std::unordered_map< std::string, SkillStatusUpdate > lastUpdates
std::optional< SkillStatusUpdate > getExecutionStatus(const SkillExecutionID &executionId) const
SkillProxy()=delete
We remove the default constructor as every skill proxy requires a manager.
bool abortSkillAsync(const SkillExecutionID &executionId) const
ask skill to abort ASAP
bool abortSkill(const SkillExecutionID &executionId) const
ask skill to abort ASAP. Blocks until skill stopped
SkillID getSkillId() const
get the skill id from the skill description
aron::data::DictPtr getRootProfileParameters() const
get the default parameters of the skill. TODO: Skill profiles in memory!
void updateSubSkillStatus(const skills::SkillStatusUpdate &statusUpdate)
std::mutex lastUpdatesMutex
SkillDescription getSkillDescription() const
get the skill description
SkillUpdateManager::CallbackID callbackId
Indicates that a skill was not found, e.g., by the skill manager.
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
#define ARMARX_VERBOSE
The logging level for verbose information.
std::shared_ptr< Dict > DictPtr
This file is part of ArmarX.
SkillUpdateManager GlobalSkillUpdateManager
This file offers overloads of toIce() and fromIce() functions for STL container types.
static SkillDescription FromIce(const provider::dto::SkillDescription &i, const std::optional< ProviderID > &=std::nullopt)
std::string toString() const
static SkillExecutionID FromIce(const skills::manager::dto::SkillExecutionID &)
skills::manager::dto::SkillExecutionID toManagerIce() const
SkillExecutionID executionId
static SkillStatusUpdate FromIce(const provider::dto::SkillStatusUpdate &update, const std::optional< skills::ProviderID > &providerId=std::nullopt)
provider::dto::SkillStatusUpdate toProviderIce() const
bool hasBeenTerminated() const
static TerminatedSkillStatusUpdate FromIce(const provider::dto::SkillStatusUpdate &update, const std::optional< skills::ProviderID > &providerId=std::nullopt)