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