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::navigation_skill_provider
17 * @author Fabian Reister ( fabian dot reister at kit dot edu )
18 * @date 2023
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 <mutex>
27#include <string>
28
31
35
44
45#include <armarx/navigation/client/ice/NavigatorInterface.h>
47#include <armarx/navigation/components/navigation_skill_provider/ComponentInterface.h>
58
60{
61
62 class Component :
63 virtual public armarx::Component,
64 virtual public ComponentInterface,
66 // virtual public armarx::navigation::client::ComponentPluginUser,
69 // , virtual public armarx::DebugObserverComponentPluginUser
72 {
73 public:
74 Component();
75 /// @see armarx::ManagedIceObject::getDefaultName()
76 std::string getDefaultName() const override;
77
78 /// Get the component's default name.
79 static std::string GetDefaultName();
80
81
82 protected:
83 /// @see PropertyUser::createPropertyDefinitions()
85
86 /// @see armarx::ManagedIceObject::onInitComponent()
87 void onInitComponent() override;
88
89 /// @see armarx::ManagedIceObject::onConnectComponent()
90 void onConnectComponent() override;
91
92 /// @see armarx::ManagedIceObject::onDisconnectComponent()
93 void onDisconnectComponent() override;
94
95 /// @see armarx::ManagedIceObject::onExitComponent()
96 void onExitComponent() override;
97
98
99 /// This function should be called once in onConnect() or when you
100 /// need to re-create the Remote GUI tab.
101 void createRemoteGuiTab();
102
103 /// After calling `RemoteGui_startRunningTask`, this function is
104 /// called periodically in a separate thread. If you update variables,
105 /// make sure to synchronize access to them.
106 void RemoteGui_update() override;
107
108
109 private:
110 // Private methods go here.
111
112 // Forward declare `Properties` if you used it before its defined.
113 // struct Properties;
114
115 /* (Requires the armarx::ArVizComponentPluginUser.)
116 /// Draw some boxes in ArViz.
117 void drawBoxes(const Properties& p, viz::Client& arviz);
118 */
119
120
121 private:
122 static const std::string defaultName;
123
124 /// Properties shown in the Scenario GUI.
125 struct Properties
126 {
127 std::string robotName;
128
130
131 core::GeneralConfig generalConfig;
132
133 skills::NavigateToNamedLocation::Properties navigateToNamedLocation;
134
135 skills::NavigateToChargingStation::Properties navigateToChargingStation;
136 };
137
138 std::mutex safetyGuardParamsMutex;
139
140 Properties properties;
141
142
143 client::NavigatorHandlePtr iceNavigator;
144
145 client::NavigatorInterfacePrx navigatorPrx;
146
147 std::optional<client::IceNavigatorFactory> iceNavigatorFactory;
148
149 template <typename T>
150 using ReaderWriterPlugin = armem::client::plugins::ReaderWriterPlugin<T>;
151
152
153 ReaderWriterPlugin<armem::robot_state::VirtualRobotReader>* virtualRobotReaderPlugin =
154 nullptr;
155 ReaderWriterPlugin<memory::client::costmap::Reader>* costmapReaderPlugin = nullptr;
156 ReaderWriterPlugin<memory::client::graph::Reader>* graphReaderPlugin = nullptr;
157 ReaderWriterPlugin<memory::client::rooms::Reader>* roomsReaderPlugin = nullptr;
158 ReaderWriterPlugin<armarx::armem::obj::clazz::ClassReader>* objectClassReaderPlugin =
159 nullptr;
160
161 struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
162 {
171
173 armarx::RemoteGui::Client::CheckBox enableLaserScanners;
174
175 ProximityField humanProximityField;
176 ProximityField laserScannerProximityField;
177 };
178
179 RemoteGuiTab tab;
180 };
181
182} // namespace armarx::navigation::components::navigation_skill_provider
Provides a ready-to-use ArViz client arviz as member variable.
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
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
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.
client::plugins::ListeningPluginUser ListeningClientPluginUser
std::unique_ptr< core::NavigatorInterface > NavigatorHandlePtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.