GazeTargetWaiter Class Reference

Blocks until the gaze is fixed on a requested target. More...

#include <armarx/view_selection/client/GazeTargetWaiter.h>

Classes

struct  Result
 

Public Member Functions

void bind (const std::string &targetName, const armem::MemoryID &gazeTargetID)
 Narrow the expectation to the exact request snapshot, once the commit returned its ID.
 
void expect (const std::string &targetName)
 Start collecting updates for this target. Call before committing it.
 
void forget (const std::string &targetName)
 Drop an expectation without waiting for it.
 
 GazeTargetWaiter (StatusHandlerInterface &handler)
 
Result wait (const std::string &targetName, const armarx::Duration &timeout, const std::function< bool()> &shouldAbort)
 Block until the target is reached, ends, the abort predicate fires or the timeout expires.
 

Detailed Description

Blocks until the gaze is fixed on a requested target.

The analogue of navigation's client::Navigator::waitForStop, with two differences that matter here:

  • An expectation is armed before the target is committed, so a status that arrives while the caller is still on its way into wait() is not lost. (navigation::client::Navigator documents this as an open race.)
  • Waiting sleeps on a condition variable rather than spinning on a future, and re-checks the abort predicate on a fixed tick.

One instance serves a whole client: expectations are keyed by target name, which is also the memory entity name, so concurrently running skills necessarily use distinct keys.

Definition at line 35 of file GazeTargetWaiter.h.

Constructor & Destructor Documentation

◆ GazeTargetWaiter()

Definition at line 29 of file GazeTargetWaiter.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ bind()

void bind ( const std::string & targetName,
const armem::MemoryID & gazeTargetID )

Narrow the expectation to the exact request snapshot, once the commit returned its ID.

Definition at line 45 of file GazeTargetWaiter.cpp.

+ Here is the call graph for this function:

◆ expect()

void expect ( const std::string & targetName)

Start collecting updates for this target. Call before committing it.

Definition at line 36 of file GazeTargetWaiter.cpp.

◆ forget()

void forget ( const std::string & targetName)

Drop an expectation without waiting for it.

Definition at line 69 of file GazeTargetWaiter.cpp.

◆ wait()

GazeTargetWaiter::Result wait ( const std::string & targetName,
const armarx::Duration & timeout,
const std::function< bool()> & shouldAbort )

Block until the target is reached, ends, the abort predicate fires or the timeout expires.

Consumes the expectation.

Parameters
timeoutA non-positive duration waits indefinitely.
shouldAbortPolled regularly; typically the skill's shouldSkillTerminate().

Definition at line 105 of file GazeTargetWaiter.cpp.

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: