ArticulatedObjectLocalizerDynamicSimulation.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::ArticulatedObjectLocalizerDynamicSimulation
17  * @author Fabian Reister ( fabian dot reister at kit dot edu )
18  * @date 2021
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <memory>
26 #include <unordered_map>
27 #include <vector>
28 
29 #include <VirtualRobot/VirtualRobot.h>
30 
32 #include <ArmarXCore/util/tasks.h>
33 
39 
40 #include <ArmarXSimulation/interface/simulator/SimulatorInterface.h>
41 
42 namespace armarx
43 {
44 
45  /**
46  * @defgroup Component-ArticulatedObjectLocalizerDynamicSimulation ArticulatedObjectLocalizerDynamicSimulation
47  * @ingroup ArmarXSimulation-Components
48  * A description of the component ArticulatedObjectLocalizerDynamicSimulation.
49  *
50  * @class ArticulatedObjectLocalizerDynamicSimulation
51  * @ingroup Component-ArticulatedObjectLocalizerDynamicSimulation
52  * @brief Brief description of class ArticulatedObjectLocalizerDynamicSimulation.
53  *
54  * Detailed description of class ArticulatedObjectLocalizerDynamicSimulation.
55  */
57  virtual public armarx::Component,
59  {
60  public:
62 
63  /// @see armarx::ManagedIceObject::getDefaultName()
64  std::string getDefaultName() const override;
65 
66 
67  protected:
68  /// @see PropertyUser::createPropertyDefinitions()
70 
71  /// @see armarx::ManagedIceObject::onInitComponent()
72  void onInitComponent() override;
73 
74  /// @see armarx::ManagedIceObject::onConnectComponent()
75  void onConnectComponent() override;
76 
77  /// @see armarx::ManagedIceObject::onDisconnectComponent()
78  void onDisconnectComponent() override;
79 
80  /// @see armarx::ManagedIceObject::onExitComponent()
81  void onExitComponent() override;
82 
83 
84  void setupObjects();
85  void localizeObjects();
86 
87  private:
88  // Private member variables go here.
89  SimulatorInterfacePrx simulator;
90 
91 
92  template <typename T>
94 
96  articulatedObjectWriterPlugin = nullptr;
97 
99  articulatedObjectReaderPlugin = nullptr;
100 
103 
104  std::mutex knownObjectsMtx;
105  std::unordered_map<std::string, std::shared_ptr<VirtualRobot::Robot>> knownObjects;
106 
107  /// Properties shown in the Scenario GUI.
108  struct Properties
109  {
110  int cycleTime = 30;
111  int cycleTimeUpdateObjectsInSimulator = 500;
112  std::vector<std::string> objects = {};
113  };
114 
115  Properties p;
116  };
117 } // namespace armarx
armarx::ArticulatedObjectLocalizerDynamicSimulation
Brief description of class ArticulatedObjectLocalizerDynamicSimulation.
Definition: ArticulatedObjectLocalizerDynamicSimulation.h:56
armarx::ArticulatedObjectLocalizerDynamicSimulation::setupObjects
void setupObjects()
Definition: ArticulatedObjectLocalizerDynamicSimulation.cpp:114
armarx::ArticulatedObjectLocalizerDynamicSimulation::onInitComponent
void onInitComponent() override
Definition: ArticulatedObjectLocalizerDynamicSimulation.cpp:66
armarx::ArticulatedObjectLocalizerDynamicSimulation::onDisconnectComponent
void onDisconnectComponent() override
Definition: ArticulatedObjectLocalizerDynamicSimulation.cpp:97
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::ArticulatedObjectLocalizerDynamicSimulation::ArticulatedObjectLocalizerDynamicSimulation
ArticulatedObjectLocalizerDynamicSimulation()
Definition: ArticulatedObjectLocalizerDynamicSimulation.cpp:59
ReaderWriterPlugin.h
armarx::ArticulatedObjectLocalizerDynamicSimulation::onConnectComponent
void onConnectComponent() override
Definition: ArticulatedObjectLocalizerDynamicSimulation.cpp:71
types.h
armarx::ArticulatedObjectLocalizerDynamicSimulation::getDefaultName
std::string getDefaultName() const override
Definition: ArticulatedObjectLocalizerDynamicSimulation.cpp:108
armarx::ArticulatedObjectLocalizerDynamicSimulation::localizeObjects
void localizeObjects()
Definition: ArticulatedObjectLocalizerDynamicSimulation.cpp:218
tasks.h
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:91
armarx::ArticulatedObjectLocalizerDynamicSimulation::onExitComponent
void onExitComponent() override
Definition: ArticulatedObjectLocalizerDynamicSimulation.cpp:103
Writer.h
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::ArticulatedObjectLocalizerDynamicSimulation::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ArticulatedObjectLocalizerDynamicSimulation.cpp:45
armarx::armem::client::plugins::ListeningPluginUser
A memory name system client which listens to the memory updates topic (MemoryListenerInterface).
Definition: ListeningPluginUser.h:21
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
Reader.h
ListeningPluginUser.h