7 #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)
55 defaultParameters.location =
"";
56 defaultParameters.velocityLimitAngular = std::nullopt;
57 defaultParameters.velocityLimitLinear = std::nullopt;
61 <<
"Retrieve the location `location` from the memory and navigate to it."
62 <<
"\n\nThe `location` is specified by its provider segment name and entity name"
63 " in the format `providerSegmentName/entityName` .";
70 .parametersType = Params::ToAronType(),
83 trajControllerParams{};
86 client::GeneralConfig generalParams{};
88 if (in.parameters.velocityLimitLinear.has_value())
90 trajControllerParams.limits.linear = in.parameters.velocityLimitLinear.value();
91 globalPlannerParams.
linearVelocity = in.parameters.velocityLimitLinear.value();
92 generalParams.maxVel.linear = in.parameters.velocityLimitLinear.value();
95 if (in.parameters.velocityLimitAngular.has_value())
97 trajControllerParams.limits.angular = in.parameters.velocityLimitAngular.value();
98 globalPlannerParams.angularVelocity = in.parameters.velocityLimitAngular.value();
99 generalParams.maxVel.angular = in.parameters.velocityLimitAngular.value();
102 ARMARX_INFO <<
"Configuring navigator to respect the velocity limits:";
103 ARMARX_INFO <<
"linear: " << trajControllerParams.limits.linear;
104 ARMARX_INFO <<
"angular: " << trajControllerParams.limits.angular;
107 client::NavigationStackConfig cfg;
108 cfg.general(generalParams);
109 cfg.globalPlanner(globalPlannerParams);
110 cfg.trajectoryController(trajControllerParams);
116 memorySubscriber.reset();
119 memorySubscriber.emplace(configId, srv_->memoryNameSystem);
123 srv_->iceNavigator.createConfig(cfg, configId);
125 navigator.emplace(client::Navigator::InjectedServices{
126 .navigator = &srv_->iceNavigator, .subscriber = &memorySubscriber.value()});
128 return ::armarx::skills::Skill::InitResult{
129 .status = ::armarx::skills::TerminatedSkillStatus::Succeeded};
135 const std::string& location = in.parameters.location;
145 navigator->moveToLocation(location);
149 auto future = std::async(std::launch::async, [
this]() {
return navigator->waitForStop(); });
160 auto se = future.get();
163 ARMARX_INFO <<
"Goal `" << location <<
"`reached.";
164 return ::armarx::skills::Skill::MainResult{
165 .status = ::armarx::skills::TerminatedSkillStatus::Succeeded};
169 if (se.isSafetyStopTriggeredEvent())
173 return ::armarx::skills::Skill::MainResult{
174 .status = ::armarx::skills::TerminatedSkillStatus::Failed};
176 if (se.isUserAbortTriggeredEvent())
180 return ::armarx::skills::Skill::MainResult{
181 .status = ::armarx::skills::TerminatedSkillStatus::Aborted};
183 if (se.isInternalErrorEvent())
186 << se.toInternalErrorEvent().message;
188 return ::armarx::skills::Skill::MainResult{
189 .status = ::armarx::skills::TerminatedSkillStatus::Failed};
193 return ::armarx::skills::Skill::MainResult{
194 .status = ::armarx::skills::TerminatedSkillStatus::Failed};
198 NavigateToLocation::onStopRequested()
200 if (navigator.has_value())