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 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>
93 using ReaderWriterPlugin = armem::client::plugins::ReaderWriterPlugin<T>;
94
95 ReaderWriterPlugin<::armarx::armem::articulated_object::Writer>*
96 articulatedObjectWriterPlugin = nullptr;
97
98 ReaderWriterPlugin<::armarx::armem::articulated_object::Reader>*
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
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.