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 
27 
29 
34 
36 
37 
38 namespace armarx
39 {
40 
41  /**
42  * @defgroup Component-ObjectInstanceToIndex ObjectInstanceToIndex
43  * @ingroup RobotAPI-Components
44  *
45  * Links object instances in the "Index/Spatial" and "Index/Named" memory segments.
46  *
47  * @class ObjectInstanceToIndex
48  * @ingroup Component-ObjectInstanceToIndex
49  * @brief Brief description of class ObjectInstanceToIndex.
50  *
51  * Links object instances in the "Index/Spatial" and "Index/Named" memory segments.
52  */
53  // Class is currently called like component for compatibility with legacy CMake.
55  virtual public armarx::Component,
58  {
59  public:
61 
62  /// @see armarx::ManagedIceObject::getDefaultName()
63  std::string getDefaultName() const override;
64 
65  protected:
67 
68  void onInitComponent() override;
69  void onConnectComponent() override;
70  void onDisconnectComponent() override;
71  void onExitComponent() override;
72 
73 
74  // LightweightRemoteGuiComponentPluginUser interface
75  public:
76  void createRemoteGuiTab();
77  void RemoteGui_update() override;
78 
79 
80  private:
81  void processRobotState(const armem::MemoryID& id,
82  const std::vector<armem::MemoryID>& snapshotIDs);
83  void processObjectInstance(const armem::MemoryID& id,
84  const std::vector<armem::MemoryID>& snapshotIDs);
85 
86 
87  private:
88  struct Properties
89  {
90  struct Object
91  {
92  float maxFrequencyHz = 10;
93  };
94  Object object;
95  };
96  Properties properties;
97 
98  armem::client::Writer indexSpatialMemoryWriter;
99 
100 
101  armarx::plugins::ObjectPoseClientPlugin* objectClientPlugin = nullptr;
102 
103  std::mutex objectMutex;
104  std::optional<armem::objects::ObjectInstanceToIndex> object;
105 
106  armem::client::Reader robotMemoryReader;
107 
108  // armarx::RunningTask<ObjectInstanceToIndex>::pointer_type task;
109 
110  struct RemoteGuiTab : RemoteGui::Client::Tab
111  {
112  };
113  RemoteGuiTab tab;
114  };
115 } // namespace armarx
armarx::ObjectInstanceToIndex::RemoteGui_update
void RemoteGui_update() override
Definition: ObjectInstanceToIndex.cpp:129
armarx::armem::client::Reader
Reads data from a memory server.
Definition: Reader.h:24
Reader.h
Writer.h
armarx::ObjectInstanceToIndex::createRemoteGuiTab
void createRemoteGuiTab()
Definition: ObjectInstanceToIndex.cpp:119
armarx::ObjectInstanceToIndex::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: ObjectInstanceToIndex.cpp:88
armarx::ObjectInstanceToIndex::ObjectInstanceToIndex
ObjectInstanceToIndex()
Definition: ObjectInstanceToIndex.cpp:62
ObjectPoseClientPlugin.h
armarx::ObjectInstanceToIndex::Properties::Object
Definition: ObjectInstanceToIndex.h:90
Frequency.h
armarx::RemoteGui::Client::Tab
Definition: Tab.h:15
armarx::ObjectInstanceToIndex::getDefaultName
std::string getDefaultName() const override
Definition: ObjectInstanceToIndex.cpp:68
armarx::ObjectInstanceToIndex::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: ObjectInstanceToIndex.cpp:75
LightweightRemoteGuiComponentPlugin.h
armarx::ObjectInstanceToIndex::Properties::Object::maxFrequencyHz
float maxFrequencyHz
Definition: ObjectInstanceToIndex.h:92
armarx::ObjectInstanceToIndex::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: ObjectInstanceToIndex.cpp:107
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:51
armarx::LightweightRemoteGuiComponentPluginUser
Definition: LightweightRemoteGuiComponentPlugin.h:73
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::plugins::ObjectPoseClientPlugin
Definition: ObjectPoseClientPlugin.h:13
armarx::ObjectInstanceToIndex
Brief description of class ObjectInstanceToIndex.
Definition: ObjectInstanceToIndex.h:54
armarx::ObjectInstanceToIndex::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: ObjectInstanceToIndex.cpp:113
ObjectInstanceToIndex.h
armarx::armem::client::plugins::ListeningPluginUser
A memory name system client which listens to the memory updates topic (MemoryListenerInterface).
Definition: ListeningPluginUser.h:23
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
ListeningPluginUser.h