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 ArmarXSimulation::ArmarXObjects::object_memory_to_simulation
17  * @author Fabian Reister ( fabian dot reister 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 <ArmarXSimulation/interface/simulator/SimulatorInterface.h>
26 #include <ArmarXSimulation/interface/ObjectMemoryToSimulationInterface.h>
27 
29 
31 
33 {
34 
35  class Component :
36  virtual public armarx::Component,
38  // , virtual public armarx::DebugObserverComponentPluginUser
39  // , virtual public armarx::LightweightRemoteGuiComponentPluginUser
40  // , virtual public armarx::ArVizComponentPluginUser,
42  {
43  public:
44 
45  /// @see armarx::ManagedIceObject::getDefaultName()
46  std::string getDefaultName() const override;
47 
48  /// Get the component's default name.
49  static std::string GetDefaultName();
50 
51 
52  protected:
53 
54  /// @see PropertyUser::createPropertyDefinitions()
56 
57  /// @see armarx::ManagedIceObject::onInitComponent()
58  void onInitComponent() override;
59 
60  /// @see armarx::ManagedIceObject::onConnectComponent()
61  void onConnectComponent() override;
62 
63  /// @see armarx::ManagedIceObject::onDisconnectComponent()
64  void onDisconnectComponent() override;
65 
66  /// @see armarx::ManagedIceObject::onExitComponent()
67  void onExitComponent() override;
68 
69 
70  /* (Requires armarx::LightweightRemoteGuiComponentPluginUser.)
71  /// This function should be called once in onConnect() or when you
72  /// need to re-create the Remote GUI tab.
73  void createRemoteGuiTab();
74 
75  /// After calling `RemoteGui_startRunningTask`, this function is
76  /// called periodically in a separate thread. If you update variables,
77  /// make sure to synchronize access to them.
78  void RemoteGui_update() override;
79  */
80 
81 
82  private:
83 
84  // Private methods go here.
85 
86  // Forward declare `Properties` if you used it before its defined.
87  // struct Properties;
88 
89  /* (Requires the armarx::ArVizComponentPluginUser.)
90  /// Draw some boxes in ArViz.
91  void drawBoxes(const Properties& p, viz::Client& arviz);
92  */
93 
94  void synchronizeSimulator(const ::Ice::Current& c = ::Ice::emptyCurrent) override;
95 
96 
97  private:
98 
99  static const std::string defaultName;
100 
101 
102  // Private member variables go here.
103 
104 
105  /// Properties shown in the Scenario GUI.
106  struct Properties
107  {
108  std::string objectPoseProviderName = "";
109  };
110  Properties properties;
111  /* Use a mutex if you access variables from different threads
112  * (e.g. ice functions and RemoteGui_update()).
113  std::mutex propertiesMutex;
114  */
115 
116 
117  /* (Requires the armarx::LightweightRemoteGuiComponentPluginUser.)
118  /// Tab shown in the Remote GUI.
119  struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
120  {
121  armarx::RemoteGui::Client::LineEdit boxLayerName;
122  armarx::RemoteGui::Client::IntSpinBox numBoxes;
123 
124  armarx::RemoteGui::Client::Button drawBoxes;
125  };
126  RemoteGuiTab tab;
127  */
128 
129 
130  /* (Requires the armarx::ArVizComponentPluginUser.)
131  * When used from different threads, an ArViz client needs to be synchronized.
132  /// Protects the arviz client inherited from the ArViz plugin.
133  std::mutex arvizMutex;
134  */
135 
136  armarx::SimulatorInterfacePrx simulator;
137 
138  };
139 
140 } // namespace armarx::simulation::components::object_memory_to_simulation
ObjectPoseClientPlugin.h
armarx::simulation::components::object_memory_to_simulation::Component::getDefaultName
std::string getDefaultName() const override
Definition: Component.cpp:129
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::simulation::components::object_memory_to_simulation::Component::onExitComponent
void onExitComponent() override
Definition: Component.cpp:123
armarx::ObjectPoseClientPluginUser
Provides an objpose::ObjectPoseTopicPrx objectPoseTopic as member variable.
Definition: ObjectPoseClientPlugin.h:67
armarx::simulation::components::object_memory_to_simulation::Component::onConnectComponent
void onConnectComponent() override
Definition: Component.cpp:83
armarx::simulation::components::object_memory_to_simulation
Definition: Component.cpp:38
armarx::simulation::components::object_memory_to_simulation::Component::onDisconnectComponent
void onDisconnectComponent() override
Definition: Component.cpp:117
armarx::simulation::components::object_memory_to_simulation::Component::onInitComponent
void onInitComponent() override
Definition: Component.cpp:72
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::simulation::components::object_memory_to_simulation::Component
Definition: Component.h:35
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::simulation::components::object_memory_to_simulation::Component::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: Component.cpp:45
ArmarXSimulation::components::object_memory_to_simulation::ComponentInterface
Definition: ComponentInterface.ice:30
armarx::simulation::components::object_memory_to_simulation::Component::GetDefaultName
static std::string GetDefaultName()
Get the component's default name.
Definition: Component.cpp:136