Go to the documentation of this file.
12 #include <RobotAPI/interface/skills/SkillManagerInterface.h>
145 const std::string& abortedMessage =
"");
157 PrepareResult _prepare();
161 void _onTimeoutReached();
162 void _onStopRequested();
166 virtual InitResult
init();
169 virtual PrepareResult
prepare();
172 virtual MainResult
main();
175 virtual ExitResult
exit();
185 std::function<
void()>&& cb);
201 std::optional<TerminatedSkillStatusUpdate>
214 std::optional<TerminatedSkillStatusUpdate>
245 std::optional<TerminatedSkillStatusUpdate>
258 template <
class ParameterT>
259 std::optional<TerminatedSkillStatusUpdate>
279 std::optional<TerminatedSkillStatusUpdate>
299 template <
class ParameterT>
300 std::optional<TerminatedSkillStatusUpdate>
302 std::function<
void(ParameterT&
parameters)> parametersFunction)
309 parameters = ParameterT::FromAron(parametersAron);
327 manager::dti::SkillManagerInterfacePrx
manager =
nullptr;
353 mutable std::mutex conditionCallbacksMutex;
354 std::vector<std::pair<std::function<bool()>, std::function<void()>>>
355 conditionCallbacks = {};
357 std::thread conditionCheckingThread;
360 mutable std::mutex subskillsMutex;
361 std::vector<skills::SkillExecutionID> subskills;
aron::data::DictPtr getParameters() const
Get the parameters of a skill that have been set so far.
ExitResult exitSkill()
Exit method of a skill.
aron::data::DictPtr getRootProfileParameters() const
get the default parameters of the skill. TODO: Skill profiles in memory!
std::atomic_bool constructing
void setParameters(const aron::data::DictPtr &d)
Hard set the parameters, ignoring everything that has been set or merged before.
TerminatedSkillStatus status
void notifySkillToStop()
Notify the skill from extern to stop.
manager::dti::SkillManagerInterfacePrx manager
This file is part of ArmarX.
void updateParameters(const aron::data::DictPtr &d)
Merge parameters to the local parameters of the skill.
virtual PrepareResult prepare()
Override this method with the actual implementation.
A result struct for skill preparing.
armarx::aron::data::DictPtr parameters
Skill()=delete
We completely remove the default constructor! A skill without a desciption cannot exist.
virtual void onStopRequested()
std::atomic_bool preparing
void setExecutorName(const std::string &executorName)
SkillDescription getSkillDescription() const
Get the description of a skill.
std::optional< ProviderID > providerId
std::optional< TerminatedSkillStatusUpdate > callSubskill(const SkillID &skillId, std::function< void(ParameterT ¶meters)> parametersFunction)
Call a subskill with parameters based on the default parameters.
void setCallback(const CallbackT &callback)
std::function< void(const SkillStatus s, const armarx::aron::data::DictPtr &)> CallbackT
skills::SkillExecutionID callSubskillAsync(const skills::SkillProxy &proxy)
Similar to callSubskill but non-blocking.
std::atomic_bool timeoutReached
std::optional< TerminatedSkillStatusUpdate > callSubskill(const skills::SkillProxy &proxy)
Call a subskill with default parameters and block until the subskill terminates.
virtual void onTimeoutReached()
Override these methods if you want to do something special when notification comes.
virtual InitResult init()
Override this method with the actual implementation.
void installConditionWithCallback(std::function< bool()> &&f, std::function< void()> &&cb)
install a condition which is frequently checked from the conditionCheckingThread
ActiveOrTerminatedSkillStatus status
static MainResult MakeFailedResult()
ActiveOrTerminatedSkillStatus
std::shared_ptr< Value > value()
void notifyTimeoutReached()
InitResult initSkill()
Initialization of a skill.
std::atomic_bool finished
std::mutex parametersMutex
SkillDescription description
MainResult mainOfSkill()
Main method of a skill.
armarx::core::time::DateTime started
static MainResult MakeAbortedResult()
static MainResult MakeSucceededResult(aron::data::DictPtr data=nullptr)
A result struct for th main method of a skill.
std::atomic_bool initializing
void setProviderId(const skills::ProviderID &pid)
Set the provider id of the description of the skill.
A result struct for skill exit function.
virtual ExitResult exit()
Override this method with the actual implementation.
Represents a point in time.
std::shared_ptr< Dict > DictPtr
TerminatedSkillStatus status
std::optional< TerminatedSkillStatusUpdate > callSubskill(const SkillID &skillId, const ParameterT ¶meters)
Call a subskill with the given ID and parameters.
Base Class for all Logging classes.
TerminatedSkillStatus status
bool shouldSkillTerminate() const
Returns whether the skill should terminate as soon as possible.
A result struct for skill initialization.
virtual ~Skill()
Virtual destructor of a skill.
virtual MainResult main()
Override this method with the actual implementation. The callback is for status updates to the callin...
static Frequency Hertz(std::int64_t hertz)
void throwIfSkillShouldTerminate(const std::string &abortedMessage="")
PrepareResult prepareSkill()
Prepare a skill once.
void setManager(const manager::dti::SkillManagerInterfacePrx &manager)
double s(double t, double s0, double v0, double a0, double j)
static DateTime Invalid()
This file offers overloads of toIce() and fromIce() functions for STL container types.
SkillID getSkillId() const
Get the id of the skill.
armarx::core::time::DateTime exited