11#include <Eigen/Geometry>
42 std::future_status
status = f.wait_for(std::chrono::seconds(0));
43 if (
status == std::future_status::ready)
47 else if (
status == std::future_status::deferred)
59 armarx::skills::SkillDescription
63 defaultParameters.location =
"";
69 <<
"Retrieve the location `location` from the memory and navigate to it."
70 <<
"\n\nThe `location` is specified by its provider segment name and entity name"
71 " in the format `providerSegmentName/entityName` .";
76 .rootProfileDefaults = defaultParameters.toAron(),
78 .parametersType = Params::ToAronType(),
89 NavigateToLocation::init(
const Base::SpecializedInitInput& in)
91 helper.
init(in.parameters.navigatingSkillParams,
94 return ::armarx::skills::Skill::InitResult{
99 NavigateToLocation::main(
const Base::SpecializedMainInput& in)
101 const std::string& location = in.parameters.location;
102 const std::optional<std::string>& locationProvider = in.parameters.locationProvider;
112 helper.
getNavigator()->moveToLocation(location, locationProvider);
116 auto future = std::async(std::launch::async,
117 [
this]() {
return helper.
getNavigator()->waitForStop(); });
128 auto se = future.get();
132 return ::armarx::skills::Skill::MainResult{
137 if (se.isSafetyStopTriggeredEvent())
141 return ::armarx::skills::Skill::MainResult{
144 if (se.isUserAbortTriggeredEvent())
148 return ::armarx::skills::Skill::MainResult{
151 if (se.isInternalErrorEvent())
154 << se.toInternalErrorEvent().message;
156 return ::armarx::skills::Skill::MainResult{
159 if (se.isGlobalPlanningFailedEvent())
162 << se.toGlobalPlanningFailedEvent().message;
164 return ::armarx::skills::Skill::MainResult{
169 return ::armarx::skills::Skill::MainResult{
173 return ::armarx::skills::Skill::MainResult{
178 NavigateToLocation::onStopRequested()
180 if (helper.getNavigator().has_value())
183 helper.getNavigator()->stop();
static Duration Hours(std::int64_t hours)
Constructs a duration in hours.
::armarx::skills::SimpleSpecializedSkill< Params > Base
static armarx::skills::SkillDescription DefaultSkillDescription()
NavigateToLocation(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::NavigateToLocationParams ParamType
SkillDescription description
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.
const armarx::skills::SkillID NavigateToLocation
bool is_ready(std::future< R > const &f)
A result struct for skill initialization.
A result struct for th main method of a skill.