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 
42 
43 #include <armarx/navigation/client/ice/NavigatorInterface.h>
45 #include <armarx/navigation/components/navigation_skill_provider/ComponentInterface.h>
53 
55 {
56 
57  class Component :
58  virtual public armarx::Component,
59  virtual public ComponentInterface,
61  // virtual public armarx::navigation::client::ComponentPluginUser,
62  virtual public armem::ListeningClientPluginUser,
63  // , virtual public armarx::DebugObserverComponentPluginUser
66  {
67  public:
68  Component();
69  /// @see armarx::ManagedIceObject::getDefaultName()
70  std::string getDefaultName() const override;
71 
72  /// Get the component's default name.
73  static std::string GetDefaultName();
74 
75 
76  protected:
77  /// @see PropertyUser::createPropertyDefinitions()
79 
80  /// @see armarx::ManagedIceObject::onInitComponent()
81  void onInitComponent() override;
82 
83  /// @see armarx::ManagedIceObject::onConnectComponent()
84  void onConnectComponent() override;
85 
86  /// @see armarx::ManagedIceObject::onDisconnectComponent()
87  void onDisconnectComponent() override;
88 
89  /// @see armarx::ManagedIceObject::onExitComponent()
90  void onExitComponent() override;
91 
92 
93  /// This function should be called once in onConnect() or when you
94  /// need to re-create the Remote GUI tab.
95  void createRemoteGuiTab();
96 
97  /// After calling `RemoteGui_startRunningTask`, this function is
98  /// called periodically in a separate thread. If you update variables,
99  /// make sure to synchronize access to them.
100  void RemoteGui_update() override;
101 
102 
103  private:
104  // Private methods go here.
105 
106  // Forward declare `Properties` if you used it before its defined.
107  // struct Properties;
108 
109  /* (Requires the armarx::ArVizComponentPluginUser.)
110  /// Draw some boxes in ArViz.
111  void drawBoxes(const Properties& p, viz::Client& arviz);
112  */
113 
114 
115  private:
116  static const std::string defaultName;
117 
118  /// Properties shown in the Scenario GUI.
119  struct Properties
120  {
121  std::string robotName;
122 
123  safety_guard::LaserBasedProximityParams safetyGuardParams;
124 
125  skills::NavigateToNamedLocation::Properties navigateToNamedLocation;
126 
127  skills::NavigateToChargingStation::Properties navigateToChargingStation;
128  };
129 
130  std::mutex safetyGuardParamsMutex;
131 
132  Properties properties;
133 
134 
135  client::IceNavigator iceNavigator;
136 
137  client::NavigatorInterfacePrx navigatorPrx;
138 
139  template <typename T>
141 
142 
144  nullptr;
145  ReaderWriterPlugin<memory::client::costmap::Reader>* costmapReaderPlugin = nullptr;
146  ReaderWriterPlugin<memory::client::graph::Reader>* graphReaderPlugin = nullptr;
147  ReaderWriterPlugin<memory::client::rooms::Reader>* roomsReaderPlugin = nullptr;
148 
149  struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
150  {
152  {
158  };
159 
161  armarx::RemoteGui::Client::CheckBox enableLaserScanners;
162 
163  armarx::RemoteGui::Client::FloatSpinBox maxVelocityLinear;
164  armarx::RemoteGui::Client::FloatSpinBox maxVelocityAngular;
165 
166  ProximityField humanProximityField;
167  ProximityField laserScannerProximityField;
168  };
169 
170  RemoteGuiTab tab;
171  };
172 
173 } // namespace armarx::navigation::components::navigation_skill_provider
armarx::navigation::components::navigation_skill_provider::Component::RemoteGuiTab::ProximityField::k
armarx::RemoteGui::Client::FloatSpinBox k
Definition: Component.h:156
ArVizComponentPlugin.h
armarx::navigation::components::navigation_skill_provider::Component::RemoteGuiTab::ProximityField::maxDistance
armarx::RemoteGui::Client::FloatSpinBox maxDistance
Definition: Component.h:155
forward_declarations.h
armarx::navigation::safety_guard::LaserBasedProximityParams
Definition: LaserBasedProximity.h:57
armarx::navigation::components::navigation_skill_provider::ComponentInterface
Definition: ComponentInterface.ice:38
SkillProviderComponentPlugin.h
armarx::navigation::components::navigation_skill_provider::Component::RemoteGuiTab::ProximityField
Definition: Component.h:151
armarx::armem::client::plugins::ReaderWriterPlugin
A component plugin offering client-side access to a reader or writer and manages the lifecycle,...
Definition: ReaderWriterPlugin.h:44
armarx::navigation::skills::NavigateToChargingStation::Properties
Definition: NavigateToChargingStation.h:33
NavigateToNamedLocation.h
armarx::RemoteGui::Client::Tab
Definition: Tab.h:15
LaserBasedProximity.h
Reader.h
armarx::navigation::components::navigation_skill_provider::Component::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: Component.cpp:96
armarx::navigation::components::navigation_skill_provider::Component::createRemoteGuiTab
void createRemoteGuiTab()
This function should be called once in onConnect() or when you need to re-create the Remote GUI tab.
Definition: Component.cpp:288
ReaderWriterPlugin.h
armarx::navigation::client::IceNavigator
Definition: IceNavigator.h:17
armarx::navigation::components::navigation_skill_provider::Component::Component
Component()
Definition: Component.cpp:52
armarx::navigation::components::navigation_skill_provider::Component::onExitComponent
void onExitComponent() override
Definition: Component.cpp:271
Tab.h
LightweightRemoteGuiComponentPlugin.h
armarx::navigation::components::navigation_skill_provider
Definition: Component.cpp:50
armarx::SkillProviderComponentPluginUser
Definition: SkillProviderComponentPlugin.h:109
armarx::navigation::components::navigation_skill_provider::Component::getDefaultName
std::string getDefaultName() const override
Definition: Component.cpp:276
armarx::ArVizComponentPluginUser
Provides a ready-to-use ArViz client arviz as member variable.
Definition: ArVizComponentPlugin.h:35
forward_declarations.h
armarx::navigation::components::navigation_skill_provider::Component::RemoteGuiTab::ProximityField::reduceSpeed
armarx::RemoteGui::Client::CheckBox reduceSpeed
Definition: Component.h:153
armarx::navigation::components::navigation_skill_provider::Component::RemoteGuiTab::ProximityField::minDistance
armarx::RemoteGui::Client::FloatSpinBox minDistance
Definition: Component.h:154
armarx::navigation::components::navigation_skill_provider::Component::onDisconnectComponent
void onDisconnectComponent() override
Definition: Component.cpp:266
IceNavigator.h
Reader.h
armarx::navigation::components::navigation_skill_provider::Component
Definition: Component.h:57
VirtualRobotReader.h
armarx::LightweightRemoteGuiComponentPluginUser
Definition: LightweightRemoteGuiComponentPlugin.h:72
armarx::navigation::components::navigation_skill_provider::Component::RemoteGuiTab::ProximityField::lambda
armarx::RemoteGui::Client::FloatSpinBox lambda
Definition: Component.h:157
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:91
armarx::navigation::components::navigation_skill_provider::Component::GetDefaultName
static std::string GetDefaultName()
Get the component's default name.
Definition: Component.cpp:282
PropertyDefinitionContainer.h
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::RemoteGui::Client::CheckBox
Definition: Widgets.h:129
Widgets.h
armarx::navigation::skills::NavigateToNamedLocation::Properties
Definition: NavigateToNamedLocation.h:58
armarx::navigation::components::navigation_skill_provider::Component::onConnectComponent
void onConnectComponent() override
Definition: Component.cpp:156
NavigateToChargingStation.h
armarx::navigation::components::navigation_skill_provider::Component::RemoteGui_update
void RemoteGui_update() override
After calling RemoteGui_startRunningTask, this function is called periodically in a separate thread.
Definition: Component.cpp:381
armarx::RemoteGui::Client::FloatSpinBox
Definition: Widgets.h:93
armarx::armem::client::plugins::ListeningPluginUser
A memory name system client which listens to the memory updates topic (MemoryListenerInterface).
Definition: ListeningPluginUser.h:21
Reader.h
ListeningPluginUser.h
armarx::navigation::components::navigation_skill_provider::Component::onInitComponent
void onInitComponent() override
Definition: Component.cpp:146