ObjectInstanceToIndex.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package RobotAPI::ArmarXObjects::ObjectInstanceToIndex
17  * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18  * @date 2022
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <mutex>
26 
29 
31 
36 
38 
39 namespace armarx
40 {
41 
42  /**
43  * @defgroup Component-ObjectInstanceToIndex ObjectInstanceToIndex
44  * @ingroup RobotAPI-Components
45  *
46  * Links object instances in the "Index/Spatial" and "Index/Named" memory segments.
47  *
48  * @class ObjectInstanceToIndex
49  * @ingroup Component-ObjectInstanceToIndex
50  * @brief Brief description of class ObjectInstanceToIndex.
51  *
52  * Links object instances in the "Index/Spatial" and "Index/Named" memory segments.
53  */
54  // Class is currently called like component for compatibility with legacy CMake.
56  virtual public armarx::Component,
59  {
60  public:
62 
63  /// @see armarx::ManagedIceObject::getDefaultName()
64  std::string getDefaultName() const override;
65 
66  protected:
68 
69  void onInitComponent() override;
70  void onConnectComponent() override;
71  void onDisconnectComponent() override;
72  void onExitComponent() override;
73 
74 
75  // LightweightRemoteGuiComponentPluginUser interface
76  public:
77  void createRemoteGuiTab();
78  void RemoteGui_update() override;
79 
80 
81  private:
82  void processRobotState(const armem::MemoryID& id,
83  const std::vector<armem::MemoryID>& snapshotIDs);
84  void processObjectInstance(const armem::MemoryID& id,
85  const std::vector<armem::MemoryID>& snapshotIDs);
86 
87 
88  private:
89  struct Properties
90  {
91  struct Object
92  {
93  float maxFrequencyHz = 10;
94  };
95 
96  Object object;
97  };
98 
99  Properties properties;
100 
101  armem::client::Writer indexSpatialMemoryWriter;
102 
103 
104  armarx::plugins::ObjectPoseClientPlugin* objectClientPlugin = nullptr;
105 
106  std::mutex objectMutex;
107  std::optional<armem::objects::ObjectInstanceToIndex> object;
108 
109  armem::client::Reader robotMemoryReader;
110 
111  // armarx::RunningTask<ObjectInstanceToIndex>::pointer_type task;
112 
113  struct RemoteGuiTab : RemoteGui::Client::Tab
114  {
115  };
116 
117  RemoteGuiTab tab;
118  };
119 } // namespace armarx
armarx::ObjectInstanceToIndex::RemoteGui_update
void RemoteGui_update() override
Definition: ObjectInstanceToIndex.cpp:121
armarx::armem::client::Reader
Reads data from a memory server.
Definition: Reader.h:23
Reader.h
Writer.h
armarx::ObjectInstanceToIndex::createRemoteGuiTab
void createRemoteGuiTab()
Definition: ObjectInstanceToIndex.cpp:112
armarx::ObjectInstanceToIndex::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: ObjectInstanceToIndex.cpp:84
armarx::ObjectInstanceToIndex::ObjectInstanceToIndex
ObjectInstanceToIndex()
Definition: ObjectInstanceToIndex.cpp:60
ObjectPoseClientPlugin.h
armarx::ObjectInstanceToIndex::Properties::Object
Definition: ObjectInstanceToIndex.h:91
Frequency.h
armarx::RemoteGui::Client::Tab
Definition: Tab.h:15
armarx::ObjectInstanceToIndex::getDefaultName
std::string getDefaultName() const override
Definition: ObjectInstanceToIndex.cpp:66
armarx::ObjectInstanceToIndex::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: ObjectInstanceToIndex.cpp:72
LightweightRemoteGuiComponentPlugin.h
armarx::ObjectInstanceToIndex::Properties::Object::maxFrequencyHz
float maxFrequencyHz
Definition: ObjectInstanceToIndex.h:93
armarx::ObjectInstanceToIndex::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: ObjectInstanceToIndex.cpp:102
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::client::Writer
Helps a memory client sending data to a memory.
Definition: Writer.h:22
armarx::ObjectInstanceToIndex::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ObjectInstanceToIndex.cpp:50
armarx::LightweightRemoteGuiComponentPluginUser
Definition: LightweightRemoteGuiComponentPlugin.h:72
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:91
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::plugins::ObjectPoseClientPlugin
Definition: ObjectPoseClientPlugin.h:12
armarx::ObjectInstanceToIndex
Brief description of class ObjectInstanceToIndex.
Definition: ObjectInstanceToIndex.h:55
armarx::ObjectInstanceToIndex::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: ObjectInstanceToIndex.cpp:107
ObjectInstanceToIndex.h
armarx::armem::client::plugins::ListeningPluginUser
A memory name system client which listens to the memory updates topic (MemoryListenerInterface).
Definition: ListeningPluginUser.h:21
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
ListeningPluginUser.h