32 auto stopped_callback = [
this](
const auto& e) { stopped(
StopEvent(e)); };
34 srv.subscriber->onGoalReached(stopped_callback);
35 srv.subscriber->onSafetyStopTriggered(stopped_callback);
36 srv.subscriber->onUserAbortTriggered(stopped_callback);
37 srv.subscriber->onInternalError(stopped_callback);
38 srv.subscriber->onGlobalPlanningFailed(stopped_callback);
45 moveTo(std::vector<core::Pose>{pose}, frame);
56 std::scoped_lock
const l{stoppedInfo.m};
57 stoppedInfo.event.reset();
59 srv.navigator->moveTo(waypoints, frame);
68 const std::vector<WaypointTarget>& path = builder.
path();
74 std::scoped_lock
const l{stoppedInfo.m};
75 stoppedInfo.event.reset();
77 srv.navigator->moveTo(path, frame);
90 std::scoped_lock
const l{stoppedInfo.m};
91 stoppedInfo.event.reset();
93 srv.navigator->moveToAlternatives(
targets, frame);
102 srv.navigator->update(waypoints, frame);
114 std::scoped_lock
const l{stoppedInfo.m};
115 stoppedInfo.event.reset();
117 srv.navigator->moveTowards(direction, frame);
122 const std::optional<std::string>& providerName)
130 std::scoped_lock
const l{stoppedInfo.m};
131 stoppedInfo.event.reset();
133 srv.navigator->moveToLocation(
location, providerName);
141 srv.navigator->setVelocityFactor(velocityFactor);
149 srv.navigator->pause();
157 srv.navigator->resume();
165 srv.navigator->stop();
190 std::future<void> future = std::async(
194 std::unique_lock l{stoppedInfo.m};
195 stoppedInfo.cv.wait(l, [&i = stoppedInfo] {
return i.event.has_value(); });
202 auto status = future.wait_for(std::chrono::milliseconds(timeoutMs));
207 case std::future_status::ready:
208 ARMARX_INFO <<
"waitForStop: terminated on goal reached";
210 case std::future_status::timeout:
211 ARMARX_INFO <<
"waitForStop: terminated due to timeout";
215 throw LocalException(
"Navigator::waitForStop: timeout");
217 case std::future_status::deferred:
233 stoppedInfo.event.reset();
243 std::scoped_lock l{stoppedInfo.m};
244 stoppedInfo.event = e;
246 stoppedInfo.cv.notify_all();
void setVelocityFactor(float velocityFactor)
void update(const std::vector< core::Pose > &waypoints, core::NavigationFrame frame)
void moveToLocation(const std::string &location, const std::optional< std::string > &providerName)
Navigator(const InjectedServices &services)
void moveTo(const core::Pose &pose, core::NavigationFrame frame)
void moveToAlternatives(const std::vector< core::TargetAlternative > &targets, core::NavigationFrame frame)
StopEvent waitForStop(std::int64_t timeoutMs=-1)
void moveTowards(const core::Direction &direction, core::NavigationFrame frame)
void onGoalReached(const std::function< void(void)> &callback)
void onWaypointReached(const std::function< void(int)> &callback)
const WaypointTargets & path() const
Brief description of class targets.
#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_INFO
The normal logging level.
#define ARMARX_VERBOSE
The logging level for verbose information.
This file is part of ArmarX.
void validate(const std::vector< WaypointTarget > &path)
Eigen::Vector3f Direction
This file is part of ArmarX.
Event describing that the targeted goal was successfully reached.