8#include <Eigen/Geometry>
34 std::future_status
status = f.wait_for(std::chrono::seconds(0));
35 if (
status == std::future_status::ready)
39 else if (
status == std::future_status::deferred)
59 NavigateToAlternatives::init(
const Base::SpecializedInitInput& in)
61 helper.
init(in.parameters.navigatingSkillParams,
64 return ::armarx::skills::Skill::InitResult{
69 NavigateToAlternatives::main(
const Base::SpecializedMainInput& in)
71 std::vector<core::TargetAlternative> targetAlternatives;
72 for (
const auto& t : in.parameters.targetAlternatives)
74 core::TargetAlternative bo;
76 targetAlternatives.emplace_back(bo);
79 ARMARX_INFO <<
"moving to " << targetAlternatives.size() <<
" alternatives";
83 helper.
getNavigator()->moveToAlternatives(targetAlternatives,
89 auto future = std::async(std::launch::async,
90 [
this]() {
return helper.
getNavigator()->waitForStop(); });
96 helper.getNavigator()->stop();
101 auto se = future.get();
108 if (se.isSafetyStopTriggeredEvent())
112 return ::armarx::skills::Skill::MainResult{
115 if (se.isUserAbortTriggeredEvent())
119 return ::armarx::skills::Skill::MainResult{
122 if (se.isInternalErrorEvent())
125 << se.toInternalErrorEvent().message;
127 return ::armarx::skills::Skill::MainResult{
130 if (se.isGlobalPlanningFailedEvent())
133 << se.toGlobalPlanningFailedEvent().message;
135 return ::armarx::skills::Skill::MainResult{
140 return ::armarx::skills::Skill::MainResult{
145 return ::armarx::skills::Skill::MainResult{
150 NavigateToAlternatives::onStopRequested()
152 if (helper.getNavigator().has_value())
155 helper.getNavigator()->stop();
159 armarx::skills::SkillDescription
163 defaultParameters.targetAlternatives = {};
168 .description =
"Navigate to a list of prioritized target alternatives.",
169 .rootProfileDefaults = defaultParameters.toAron(),
171 .parametersType = Params::ToAronType()};
static Duration Hours(std::int64_t hours)
Constructs a duration in hours.
::armarx::skills::SimpleSpecializedSkill< Params > Base
static armarx::skills::SkillDescription DefaultSkillDescription()
NavigateToAlternatives(const NavigatingSkillHelper::Properties &properties, const NavigatingSkillHelper::Services &srv)
std::optional< client::Navigator > & getNavigator()
void init(const arondto::NavigatingSkillParams ¶ms, const std::string &id)
static arondto::NavigatingSkillParams DefaultSkillDescription()
arondto::NavigateToAlternativesParams ParamType
std::atomic_bool timeoutReached
bool shouldSkillTerminate() const override
Returns whether the skill should terminate as soon as possible.
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
#define ARMARX_INFO
The normal logging level.
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
void fromAron(const arondto::GlobalTrajectoryPoint &dto, GlobalTrajectoryPoint &bo)
const std::string NavigateToAlternatives
bool is_ready(std::future< R > const &f)
A result struct for skill initialization.
A result struct for th main method of a skill.