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::costmap_example
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#include <string>
27
28#include <Eigen/Core>
29
33
35
38
39#include <armarx/navigation/components/costmap_example/ComponentInterface.h>
41
43{
44
45 class Component :
46 virtual public armarx::Component,
48 // , virtual public armarx::DebugObserverComponentPluginUser
50 // , virtual public armarx::ArVizComponentPluginUser
51 {
52 public:
53 Component();
54
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 /// This function should be called once in onConnect() or when you
80 /// need to re-create the Remote GUI tab.
81 void createRemoteGuiTab();
82
83 /// After calling `RemoteGui_startRunningTask`, this function is
84 /// called periodically in a separate thread. If you update variables,
85 /// make sure to synchronize access to them.
86 void RemoteGui_update() override;
87
88 void run();
89
91
92
93 private:
94 // Private methods go here.
95
96 // Forward declare `Properties` if you used it before its defined.
97 // struct Properties;
98
99 /* (Requires the armarx::ArVizComponentPluginUser.)
100 /// Draw some boxes in ArViz.
101 void drawBoxes(const Properties& p, viz::Client& arviz);
102 */
103
104
105 private:
106 static const std::string defaultName;
107
108 // Private member variables go here.
109
110
111 /// Properties shown in the Scenario GUI.
112 struct Properties
113 {
114 bool updateSize = false;
115 int size = 5000;
116 };
117
118 Properties properties;
119
120 /* Use a mutex if you access variables from different threads
121 * (e.g. ice functions and RemoteGui_update()).
122 std::mutex propertiesMutex;
123 */
124
125 std::mutex areasMutex;
126 std::vector<Eigen::AlignedBox2f> blockedAreas;
127
128 /// Tab shown in the Remote GUI.
129 struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
130 {
132
137
139 };
140
141 RemoteGuiTab tab;
142
143
145 costmapWriterPlugin = nullptr;
146 };
147
148} // namespace armarx::navigation::components::costmap_example
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
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,...
void RemoteGui_update() override
After calling RemoteGui_startRunningTask, this function is called periodically in a separate thread.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition Component.cpp:56
RunningTask< Component >::pointer_type costmapUpdateTask
Definition Component.h:90
static std::string GetDefaultName()
Get the component's default name.
void createRemoteGuiTab()
This function should be called once in onConnect() or when you need to re-create the Remote GUI tab.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.