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
39namespace 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
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
void onInitComponent() override
Pure virtual hook for the subclass.
void onDisconnectComponent() override
Hook for subclass.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onConnectComponent() override
Pure virtual hook for the subclass.
void onExitComponent() override
Hook for subclass.
std::string getDefaultName() const override
Reads data from a memory server.
Definition Reader.h:25
Helps a memory client sending data to a memory.
Definition Writer.h:23
client::plugins::ListeningPluginUser ListeningClientPluginUser
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.