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 
43 namespace armarx
44 {
45 
46  /**
47  * @defgroup Component-ArticulatedObjectLocalizerDynamicSimulation ArticulatedObjectLocalizerDynamicSimulation
48  * @ingroup ArmarXSimulation-Components
49  * A description of the component ArticulatedObjectLocalizerDynamicSimulation.
50  *
51  * @class ArticulatedObjectLocalizerDynamicSimulation
52  * @ingroup Component-ArticulatedObjectLocalizerDynamicSimulation
53  * @brief Brief description of class ArticulatedObjectLocalizerDynamicSimulation.
54  *
55  * Detailed description of class ArticulatedObjectLocalizerDynamicSimulation.
56  */
58  virtual public armarx::Component,
60  {
61  public:
62 
64 
65  /// @see armarx::ManagedIceObject::getDefaultName()
66  std::string getDefaultName() const override;
67 
68 
69  protected:
70 
71  /// @see PropertyUser::createPropertyDefinitions()
73 
74  /// @see armarx::ManagedIceObject::onInitComponent()
75  void onInitComponent() override;
76 
77  /// @see armarx::ManagedIceObject::onConnectComponent()
78  void onConnectComponent() override;
79 
80  /// @see armarx::ManagedIceObject::onDisconnectComponent()
81  void onDisconnectComponent() override;
82 
83  /// @see armarx::ManagedIceObject::onExitComponent()
84  void onExitComponent() override;
85 
86 
87  void setupObjects();
88  void localizeObjects();
89 
90  private:
91 
92  // Private member variables go here.
93  SimulatorInterfacePrx simulator;
94 
95 
96  template <typename T>
98 
100  nullptr;
101 
103  nullptr;
104 
107 
108  std::mutex knownObjectsMtx;
109  std::unordered_map<std::string, std::shared_ptr<VirtualRobot::Robot>> knownObjects;
110 
111  /// Properties shown in the Scenario GUI.
112  struct Properties
113  {
114  int cycleTime = 30;
115  int cycleTimeUpdateObjectsInSimulator = 500;
116  std::vector<std::string> objects = {};
117  };
118  Properties p;
119 
120  };
121 }
armarx::ArticulatedObjectLocalizerDynamicSimulation
Brief description of class ArticulatedObjectLocalizerDynamicSimulation.
Definition: ArticulatedObjectLocalizerDynamicSimulation.h:57
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:95
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:23
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
Reader.h
ListeningPluginUser.h