commit_and_wait.cpp
Go to the documentation of this file.
1#include "commit_and_wait.h"
2
6
8
11
13{
14
17 const gaze_targets::GazeTarget& target,
18 const bool waitUntilReached,
19 const std::int64_t waitTimeout_ms,
20 const std::function<bool()>& shouldAbort)
21 {
22 ARMARX_INFO << "Committing gaze target " << target;
23
24 if (not waitUntilReached)
25 {
26 viewSelection.commitGazeTarget(target);
27
28 return ::armarx::skills::Skill::MainResult{
30 }
31
33 target, armarx::Duration::MilliSeconds(waitTimeout_ms), shouldAbort);
34
35 if (result)
36 {
37 return ::armarx::skills::Skill::MainResult{
39 }
40
41 ARMARX_WARNING << "Gaze target " << QUOTED(target.name) << " was not reached: "
42 << (result.message.empty() ? result.status.message : result.message);
43
44 // Do not leave a target we gave up on competing for the head.
45 viewSelection.releaseGazeTarget(target);
46
47 return ::armarx::skills::Skill::MainResult{
49 }
50
51} // namespace armarx::view_selection::skills
#define QUOTED(x)
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition Duration.cpp:48
armarx::armem::MemoryID commitGazeTarget(const gaze_targets::GazeTarget &target)
void releaseGazeTarget(const gaze_targets::GazeTarget &target)
Give up a target: lowest priority, no duration, not kept in the queue.
GazeTargetWaiter::Result commitGazeTargetAndWait(const gaze_targets::GazeTarget &target, const armarx::Duration &timeout, const std::function< bool()> &shouldAbort={})
Commit a gaze target and block until the robot's gaze is fixed on it.
std::string message
Reason, for the terminal states. Empty otherwise.
Business Object (BO) class of GazeTarget.
Definition GazeTarget.h:22
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:179
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
Definition Logging.h:191
This file is part of ArmarX.
::armarx::skills::Skill::MainResult commitAndMaybeWait(client::ViewSelection &viewSelection, const gaze_targets::GazeTarget &target, const bool waitUntilReached, const std::int64_t waitTimeout_ms, const std::function< bool()> &shouldAbort)
Commit a gaze target, optionally blocking until the robot's gaze is fixed on it.
A result struct for th main method of a skill.
Definition Skill.h:62
std::string message
Why the wait ended, if it did not end on a status update.