Component.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 navigation::ArmarXObjects::handover_costmap_provider
17 * @author Fabian Reister ( fabian dot reister at kit dot edu )
18 * @date 2026
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23
24#pragma once
25
26
30
34
36#include <armarx/navigation/components/handover_costmap_provider/ComponentInterface.h>
39
42
44{
45
46 class Component :
47 virtual public armarx::Component,
50 // , virtual public armarx::DebugObserverComponentPluginUser
51 // , virtual public armarx::LightweightRemoteGuiComponentPluginUser
53 {
54 public:
55 /// @see armarx::ManagedIceObject::getDefaultName()
56 std::string getDefaultName() const override;
57
58 /// Get the component's default name.
59 static std::string GetDefaultName();
60
61
62 protected:
63 /// @see PropertyUser::createPropertyDefinitions()
65
66 /// @see armarx::ManagedIceObject::onInitComponent()
67 void onInitComponent() override;
68
69 /// @see armarx::ManagedIceObject::onConnectComponent()
70 void onConnectComponent() override;
71
72 /// @see armarx::ManagedIceObject::onDisconnectComponent()
73 void onDisconnectComponent() override;
74
75 /// @see armarx::ManagedIceObject::onExitComponent()
76 void onExitComponent() override;
77
78
79 /* (Requires armarx::LightweightRemoteGuiComponentPluginUser.)
80 /// This function should be called once in onConnect() or when you
81 /// need to re-create the Remote GUI tab.
82 void createRemoteGuiTab();
83
84 /// After calling `RemoteGui_startRunningTask`, this function is
85 /// called periodically in a separate thread. If you update variables,
86 /// make sure to synchronize access to them.
87 void RemoteGui_update() override;
88 */
89
90
91 private:
92 // Private methods go here.
93
94 // Forward declare `Properties` if you used it before its defined.
95 // struct Properties;
96
97 /* (Requires the armarx::ArVizComponentPluginUser.)
98 /// Draw some boxes in ArViz.
99 void drawBoxes(const Properties& p, viz::Client& arviz);
100 */
101
102
103 private:
104 static const std::string defaultName;
105
106 // Private member variables go here.
107
108
109 /// Properties shown in the Scenario GUI.
110 struct Properties
111 {
112 struct
113 {
114 std::string providerName;
115 std::string name = "distance_to_obstacles";
116 } obstacleDistanceMap;
117
118 struct
119 {
120 std::string name = "Armar7";
121 } robot;
122
123 std::string personInstanceProviderName = "person_instance_updater";
124
126 };
127
128 Properties properties;
129
130 /* Use a mutex if you access variables from different threads
131 * (e.g. ice functions and RemoteGui_update()).
132 std::mutex propertiesMutex;
133 */
134
135
136 /* (Requires the armarx::LightweightRemoteGuiComponentPluginUser.)
137 /// Tab shown in the Remote GUI.
138 struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
139 {
140 armarx::RemoteGui::Client::LineEdit boxLayerName;
141 armarx::RemoteGui::Client::IntSpinBox numBoxes;
142
143 armarx::RemoteGui::Client::Button drawBoxes;
144 };
145 RemoteGuiTab tab;
146 */
147
148
150 void run();
151
152
153 bool readObstacleDistanceMap();
154 void queryHumans();
155
156 void computeHandoverCostmap();
157
158
159 std::optional<algorithms::Costmap> obstacleDistanceMap;
160
161 std::vector<armem::human::MemoryResolvedPersonInstance> detectedHumans;
162
163 struct Services
164 {
165
167 virtualRobotReaderPlugin = nullptr;
168
170 costmapReaderPlugin = nullptr;
171
173 costmapWriterPlugin = nullptr;
175 personInstanceReaderPlugin = nullptr;
176
177 } services;
178 };
179
180} // namespace armarx::navigation::components::handover_costmap_provider
Provides a ready-to-use ArViz client arviz as member variable.
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
Component()
Protected default constructor. Used for virtual inheritance. Use createManagedIceObject() instead.
Definition Component.cpp:66
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,...
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition Component.cpp:61
static std::string GetDefaultName()
Get the component's default name.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.