25#include <experimental/memory>
44#include <armarx/navigation/skills/aron/NavigatingSkillParams.aron.generated.h>
68 std::future_status
status = f.wait_for(std::chrono::seconds(0));
69 if (
status == std::future_status::ready)
73 else if (
status == std::future_status::deferred)
105 void init(
const arondto::NavigatingSkillParams& params,
const std::string&
id);
116 template <
typename IssueNavigationCommandT,
typename ShouldTerminateT>
119 ShouldTerminateT&& shouldTerminate)
130 issueNavigationCommand();
133 std::async(std::launch::async, [
this]() {
return navigator->waitForStop(); });
136 if (shouldTerminate())
138 ARMARX_INFO <<
"Skill should terminate. Stopping the navigator.";
155 ARMARX_WARNING <<
"Global planning failed and the retry budget of "
156 << retryTimeout_.toSecondsDouble()
157 <<
"s is exhausted. Giving up.";
163 << (deadline - now).toSecondsDouble() <<
"s left.";
167 const auto remaining = deadline - now;
168 const auto waitBudget =
173 if (shouldTerminate())
188 Properties properties_;
189 std::optional<Services> srv_;
195 std::optional<client::MemorySubscriber> memorySubscriber;
197 std::optional<client::Navigator> navigator;
static DateTime Now()
Current time on the virtual clock.
static void WaitFor(const Duration &duration)
Wait for a certain duration on the virtual clock.
The memory name system (MNS) client.
static Duration Seconds(std::int64_t seconds)
Constructs a duration in seconds.
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
core::GlobalPlanningFailedEvent & toGlobalPlanningFailedEvent()
bool isGlobalPlanningFailedEvent() const
std::optional< client::Navigator > & getNavigator()
NavigatingSkillHelper(const Properties &properties, const Services &srv)
void init(const arondto::NavigatingSkillParams ¶ms, const std::string &id)
static arondto::NavigatingSkillParams DefaultSkillDescription()
client::StopEvent moveAndWaitForStop(IssueNavigationCommandT &&issueNavigationCommand, ShouldTerminateT &&shouldTerminate)
Issues the navigation command and waits for the navigator to stop, polling shouldTerminate meanwhile.
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
#define ARMARX_INFO
The normal logging level.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
std::unique_ptr< core::NavigatorInterface > NavigatorHandlePtr
const armarx::core::time::Duration PollInterval
Granularity at which shouldTerminate is evaluated while waiting.
const armarx::core::time::Duration RetryInterval
Time to wait between two attempts to plan a path to the goal.
bool is_ready(std::future< R > const &f)
True if f holds a result (or has none to wait for). A deferred task is started here.
std::experimental::observer_ptr< std::mutex > safetyGuardParamsMutex
std::experimental::observer_ptr< safety_guard::LaserBasedProximityParams > safetyGuardParams
core::GeneralConfig defaultGeneralConfig
armem::client::MemoryNameSystem & memoryNameSystem
client::IceNavigatorFactory & iceNavigatorFactory