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
33
39
40#include <ArmarXSimulation/interface/simulator/SimulatorInterface.h>
41
42namespace 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 static std::string GetDefaultName();
65 std::string getDefaultName() const override;
66
67
68 protected:
69 /// @see PropertyUser::createPropertyDefinitions()
71
72 /// @see armarx::ManagedIceObject::onInitComponent()
73 void onInitComponent() override;
74
75 /// @see armarx::ManagedIceObject::onConnectComponent()
76 void onConnectComponent() override;
77
78 /// @see armarx::ManagedIceObject::onDisconnectComponent()
79 void onDisconnectComponent() override;
80
81 /// @see armarx::ManagedIceObject::onExitComponent()
82 void onExitComponent() override;
83
84
85 void setupObjects();
86 void localizeObjects();
87
88 private:
89 // Private member variables go here.
90 SimulatorInterfacePrx simulator;
91
92
93 template <typename T>
94 using ReaderWriterPlugin = armem::client::plugins::ReaderWriterPlugin<T>;
95
96 ReaderWriterPlugin<::armarx::armem::articulated_object::Writer>*
97 articulatedObjectWriterPlugin = nullptr;
98
99 ReaderWriterPlugin<::armarx::armem::articulated_object::Reader>*
100 articulatedObjectReaderPlugin = nullptr;
101
104
105 std::mutex knownObjectsMtx;
106 std::unordered_map<std::string, std::shared_ptr<VirtualRobot::Robot>> knownObjects;
107
108 /// Properties shown in the Scenario GUI.
109 struct Properties
110 {
111 int cycleTime = 30;
112 int cycleTimeUpdateObjectsInSimulator = 500;
113 std::vector<std::string> objects = {};
114 };
115
116 Properties p;
117 };
118} // namespace armarx
std::string getDefaultName() const override
Retrieve default name of component.
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
IceUtil::Handle< PeriodicTask< T > > pointer_type
Shared pointer type for convenience.
A component plugin offering client-side access to a reader or writer and manages the lifecycle,...
plugins::ListeningPluginUser ListeningPluginUser
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.