GraspMemory.h
Go to the documentation of this file.
1#pragma once
2
3
4#include <cstdint>
5#include <memory>
6
7#include <VirtualRobot/VirtualRobot.h>
8
11#include <ArmarXCore/interface/observers/ObserverInterface.h>
12
14
21
23{
24 /**
25 * @defgroup Component-GraspMemory GraspMemory
26 * @ingroup RobotAPI-Components
27 * A description of the component GraspMemory.
28 *
29 * @class GraspMemory
30 * @ingroup Component-GraspMemory
31 * @brief Brief description of class GraspMemory.
32 *
33 * Detailed description of class GraspMemory.
34 */
36 virtual public armarx::Component,
41 {
42 public:
44
45 /// @see armarx::ManagedIceObject::getDefaultName()
46 std::string getDefaultName() const override;
47
48
49 public:
50 armem::data::CommitResult commit(const armem::data::Commit& commit,
51 const Ice::Current&) override;
52
53
54 public:
55 armem::actions::GetActionsOutputSeq
56 getActions(const armem::actions::GetActionsInputSeq& inputs) override;
57 armem::actions::ExecuteActionOutputSeq
58 executeActions(const armem::actions::ExecuteActionInputSeq& inputs) override;
59
60 void createRemoteGuiTab();
61 void RemoteGui_update() override;
62
63
64 protected:
66
67 void onInitComponent() override;
68 void onConnectComponent() override;
69 void onDisconnectComponent() override;
70 void onExitComponent() override;
71
72
73 private:
74 DebugObserverInterfacePrx debugObserver;
75
76 struct CoreSegmentProperties
77 {
78 std::int64_t maxHistorySize = 100;
79 };
80
81 struct Properties
82 {
84 {
85 CoreSegmentProperties graspCandidate;
86 CoreSegmentProperties bimanualGraspCandidate;
87 CoreSegmentProperties knownGraspCandidate;
88 } coreSeg;
89 };
90
91 Properties properties_;
92
93 // segments
95
96 struct RemoteGuiTab : RemoteGui::Client::Tab
97 {
98 std::atomic_bool rebuild = false;
99
100 // RemoteGui::Client::ComboBox selectCoreSegment;
101 RemoteGui::Client::ComboBox selectProvider;
102 RemoteGui::Client::ComboBox selectEntity;
103 RemoteGui::Client::ComboBox selectSnapshot;
104 RemoteGui::Client::CheckBox showUnlimitedInstances;
107 RemoteGui::Client::Button deselectAll;
108 std::map<std::string, RemoteGui::Client::CheckBox> checkInstances;
109 };
110
111 struct GuiInfo
112 {
113 // int coreSegIndex = 0;
114 int providerIndex = 0;
115 int entityIndex = 0;
116 int snapshotIndex = 0;
117
118 int maxInstances = 10;
119 bool unlimitedInstances = false;
120
121 RemoteGuiTab tab;
122
123 std::string coreSegment = "GraspCandidate";
124 std::string provider = "";
125 std::string entity = "";
126 std::string snapshot = "";
127
128 std::map<std::string, Time> timeMap;
129
130 std::mutex visualizationMutex;
131 std::vector<armem::MemoryID> visibleInstanceIds;
132 std::vector<std::string> activeLayers;
133 std::vector<armem::MemoryID> trackedEntityIds;
134 bool trackNewEntities{true};
135 };
136
137 GuiInfo gui;
138
139 bool enableRemoteGui{true};
140
141 bool enableVisualizeKnownGraspCandidates = false;
142 bool enableVisualizeKnownGraspCandidatesPreposes = false;
143 bool enableVisualizeKnownGraspCandidatesApproach = false;
144
145
146 std::size_t frequencyHzVisualizeKnownGraspCandidates = 5;
147
148 void visualizeGraspCandidates();
149 void visualizeKnownGraspCandidates();
150
151 void addInstanceToVisu(const armem::MemoryID& instance);
152 void removeInstanceFromVisu(const armem::MemoryID& instance);
153 void addToHighlightLayer(const armem::MemoryID& memoryID, const std::string color);
154
155
157 virtualRobotReaderPlugin = nullptr;
158
159
160 std::map<std::string, VirtualRobot::RobotPtr> robots;
161
162 RunningTask<GraspMemory>::pointer_type taskVisuKnownGrasps;
163
164 std::map<std::string, viz::Layer> graspVisuPerObject;
165 };
166} // namespace armarx::armem::server::grasp
Provides a ready-to-use ArViz client arviz as member variable.
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
Provides an objpose::ObjectPoseTopicPrx objectPoseTopic as member variable.
IceUtil::Handle< RunningTask< T > > pointer_type
Shared pointer type for convenience.
A component plugin offering client-side access to a reader or writer and manages the lifecycle,...
armem::actions::GetActionsOutputSeq getActions(const armem::actions::GetActionsInputSeq &inputs) override
void onInitComponent() override
Pure virtual hook for the subclass.
armem::data::CommitResult commit(const armem::data::Commit &commit, const Ice::Current &) override
void onDisconnectComponent() override
Hook for subclass.
PropertyDefinitionsPtr createPropertyDefinitions() override
Creates the property definition container.
armem::actions::ExecuteActionOutputSeq executeActions(const armem::actions::ExecuteActionInputSeq &inputs) override
void onConnectComponent() override
Pure virtual hook for the subclass.
void onExitComponent() override
Hook for subclass.
std::string getDefaultName() const override
Base class of memory server components.
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface > DebugObserverInterfacePrx
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.