ViewSelection.h
Go to the documentation of this file.
1#pragma once
2
3#include <functional>
4#include <memory>
5#include <optional>
6#include <string>
7#include <vector>
8
10
19
24
26{
28
29 /// How gaze target status updates reach this client.
30 enum class StatusDelivery
31 {
32 /// Pushed by the memory. Requires the owning component to derive from
33 /// armarx::armem::client::plugins::ListeningPluginUser.
35 /// Queried every 100 ms. Works anywhere, at the cost of up to one poll period of latency.
37 };
38
40 {
41 public:
43 std::string providerSegmentName);
45
47
48 std::optional<gaze_targets::GazeTarget> readGazeTarget(const std::string& name);
49
50 /// The lifecycle of the named target, as far as the scheduler has published it.
51 std::optional<gaze_targets::GazeTargetStatus>
52 readGazeTargetStatus(const std::string& name);
53
54 /// @return The memory ID of the committed request, invalid if the commit failed.
56 void commitGazeTargets(const std::vector<gaze_targets::GazeTarget>& targets);
57
58 /**
59 * @brief Commit a gaze target and block until the robot's gaze is fixed on it.
60 *
61 * Arms the wait before committing, so a status update that arrives immediately is not
62 * missed.
63 *
64 * @param timeout A non-positive duration waits indefinitely.
65 * @param shouldAbort Polled while waiting; typically a skill's shouldSkillTerminate().
66 */
69 const armarx::Duration& timeout,
70 const std::function<bool()>& shouldAbort = {});
71
72 /// Give up a target: lowest priority, no duration, not kept in the queue.
74
75 private:
76 // Private member variables go here.
78 std::string providerSegmentName;
79 const armarx::armem::MemoryID coreSegmentID;
80 const armarx::armem::MemoryID statusCoreSegmentID;
83
84 std::unique_ptr<MemoryStatusHandlerBase> statusHandler;
85 std::optional<GazeTargetWaiter> waiter;
86 };
87
88} // namespace armarx::view_selection::client
The memory name system (MNS) client.
Reads data from a memory server.
Definition Reader.h:25
Helps a memory client sending data to a memory.
Definition Writer.h:23
Represents a duration.
Definition Duration.h:17
Turns a queried piece of the GazeTargetStatus core segment into dispatched updates.
armarx::armem::MemoryID commitGazeTarget(const gaze_targets::GazeTarget &target)
std::optional< gaze_targets::GazeTargetStatus > readGazeTargetStatus(const std::string &name)
The lifecycle of the named target, as far as the scheduler has published it.
void commitGazeTargets(const std::vector< gaze_targets::GazeTarget > &targets)
void releaseGazeTarget(const gaze_targets::GazeTarget &target)
Give up a target: lowest priority, no duration, not kept in the queue.
std::optional< gaze_targets::GazeTarget > readGazeTarget(const std::string &name)
ViewSelection(armarx::armem::client::MemoryNameSystem &mns, std::string providerSegmentName)
void connect(StatusDelivery statusDelivery=StatusDelivery::Subscription)
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.
Business Object (BO) class of GazeTarget.
Definition GazeTarget.h:22
StatusDelivery
How gaze target status updates reach this client.
@ Polling
Queried every 100 ms. Works anywhere, at the cost of up to one poll period of latency.
This file is part of ArmarX.
Definition Human.cpp:33