GraspMemory.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 #include <memory>
5 
7 #include <ArmarXCore/interface/observers/ObserverInterface.h>
11 
13 
15 {
16  /**
17  * @defgroup Component-GraspMemory GraspMemory
18  * @ingroup RobotAPI-Components
19  * A description of the component GraspMemory.
20  *
21  * @class GraspMemory
22  * @ingroup Component-GraspMemory
23  * @brief Brief description of class GraspMemory.
24  *
25  * Detailed description of class GraspMemory.
26  */
27  class GraspMemory :
28  virtual public armarx::Component
29  , virtual public armem::server::ReadWritePluginUser
31  , virtual public armarx::ArVizComponentPluginUser
32  {
33  public:
34 
35  GraspMemory();
36 
37  /// @see armarx::ManagedIceObject::getDefaultName()
38  std::string getDefaultName() const override;
39 
40 
41  public:
42  armem::data::CommitResult commit(const armem::data::Commit& commit, const Ice::Current&) override;
43 
44 
45  public:
46  armem::actions::GetActionsOutputSeq getActions(const armem::actions::GetActionsInputSeq& inputs) override;
47  armem::actions::ExecuteActionOutputSeq executeActions(const armem::actions::ExecuteActionInputSeq& inputs) override;
48 
49  void createRemoteGuiTab();
50  void RemoteGui_update() override;
51 
52 
53  protected:
54 
56 
57  void onInitComponent() override;
58  void onConnectComponent() override;
59  void onDisconnectComponent() override;
60  void onExitComponent() override;
61 
62 
63  private:
64 
65  DebugObserverInterfacePrx debugObserver;
66 
67  // segments
69 
70  struct RemoteGuiTab : RemoteGui::Client::Tab
71  {
72  std::atomic_bool rebuild = false;
73 
74  // RemoteGui::Client::ComboBox selectCoreSegment;
75  RemoteGui::Client::ComboBox selectProvider;
76  RemoteGui::Client::ComboBox selectEntity;
77  RemoteGui::Client::ComboBox selectSnapshot;
78  RemoteGui::Client::CheckBox showUnlimitedInstances;
79  RemoteGui::Client::IntSpinBox maxInstances;
80  RemoteGui::Client::Button selectAll;
81  RemoteGui::Client::Button deselectAll;
82  std::map<std::string, RemoteGui::Client::CheckBox> checkInstances;
83  };
84 
85 
86  struct GuiInfo
87  {
88  // int coreSegIndex = 0;
89  int providerIndex = 0;
90  int entityIndex = 0;
91  int snapshotIndex = 0;
92 
93  int maxInstances = 10;
94  bool unlimitedInstances = false;
95 
96  RemoteGuiTab tab;
97 
98  std::string coreSegment = "GraspCandidate";
99  std::string provider = "";
100  std::string entity = "";
101  std::string snapshot = "";
102 
103  std::map<std::string, Time> timeMap;
104 
105  std::mutex visualizationMutex;
106  std::vector<armem::MemoryID> visibleInstanceIds;
107  std::vector<std::string> activeLayers;
108  std::vector<armem::MemoryID> trackedEntityIds;
109  bool trackNewEntities{true};
110  };
111  GuiInfo gui;
112 
113  bool enableRemoteGui{true};
114 
115  void visualizeGraspCandidates();
116  void addInstanceToVisu(const armem::MemoryID& instance);
117  void removeInstanceFromVisu(const armem::MemoryID& instance);
118  void addToHighlightLayer(const armem::MemoryID& memoryID, const std::string color);
119  };
120 }
armarx::armem::server::grasp::GraspMemory::commit
armem::data::CommitResult commit(const armem::data::Commit &commit, const Ice::Current &) override
Definition: GraspMemory.cpp:78
ArVizComponentPlugin.h
armarx::armem::server::grasp::GraspMemory::getActions
armem::actions::GetActionsOutputSeq getActions(const armem::actions::GetActionsInputSeq &inputs) override
Definition: GraspMemory.cpp:149
armarx::armem::server::grasp
Definition: GraspMemory.cpp:19
ReadWritePluginUser.h
armarx::armem::server::grasp::GraspMemory::createRemoteGuiTab
void createRemoteGuiTab()
Definition: GraspMemory.cpp:392
armarx::RemoteGui::Client::Tab
Definition: Tab.h:15
KnownGraspProviderSegment.h
armarx::armem::server::grasp::GraspMemory::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: GraspMemory.cpp:57
armarx::armem::server::grasp::GraspMemory::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: GraspMemory.cpp:70
LightweightRemoteGuiComponentPlugin.h
armarx::armem::server::grasp::GraspMemory::executeActions
armem::actions::ExecuteActionOutputSeq executeActions(const armem::actions::ExecuteActionInputSeq &inputs) override
Definition: GraspMemory.cpp:210
armarx::ArVizComponentPluginUser
Provides a ready-to-use ArViz client arviz as member variable.
Definition: ArVizComponentPlugin.h:36
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::server::grasp::GraspMemory::RemoteGui_update
void RemoteGui_update() override
Definition: GraspMemory.cpp:906
armarx::armem::server::grasp::GraspMemory::GraspMemory
GraspMemory()
Definition: GraspMemory.cpp:40
armarx::armem::server::plugins::ReadWritePluginUser
Base class of memory server components.
Definition: ReadWritePluginUser.h:20
armarx::armem::server::grasp::GraspMemory
Brief description of class GraspMemory.
Definition: GraspMemory.h:27
armarx::RemoteGui::Client::ComboBox
Definition: Widgets.h:50
armarx::LightweightRemoteGuiComponentPluginUser
Definition: LightweightRemoteGuiComponentPlugin.h:73
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::armem::server::grasp::GraspMemory::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: GraspMemory.cpp:45
armarx::armem::server::grasp::GraspMemory::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: GraspMemory.cpp:21
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::armem::index::memoryID
const MemoryID memoryID
Definition: memory_ids.cpp:29
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
armarx::RemoteGui::Client::IntSpinBox
Definition: Widgets.h:69
armarx::RemoteGui::Client::CheckBox
Definition: Widgets.h:129
armarx::RemoteGui::Client::Button
Definition: Widgets.h:120
armarx::armem::server::grasp::GraspMemory::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: GraspMemory.cpp:66
armarx::armem::server::grasp::GraspMemory::getDefaultName
std::string getDefaultName() const override
Definition: GraspMemory.cpp:35
armarx::armem::grasping::segment::KnownGraspProviderSegment
Definition: KnownGraspProviderSegment.h:10