PersonMemoryDebugger.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 VisionX::ArmarXObjects::person_memory_debugger
17  * @author Peter Albrecht ( usnlf at student dot kit dot edu )
18  * @date 2024
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 
24 #pragma once
25 
26 #include <optional>
27 
28 #include <Eigen/Core>
29 
31 
36 
38 {
39 
40  /**
41  * This component can be used for debugging of the person memory; more specifically it commits instances
42  * into the person memory based on user input. This is useful to provoce certain cases.\n
43  * The component must be started inside a terminal. The HumanMemory should be running.\n
44  * Important: do not use this in a real environment, as it most certainly will lead to unexpected behaviour.
45  * Do not depend on the data supplied here, it is mostly incoherent.
46  */
48  virtual public armarx::Component,
50  {
51  public:
52  /// @see armarx::ManagedIceObject::getDefaultName()
53  std::string getDefaultName() const override;
54 
55  /// Get the component's default name.
56  static std::string GetDefaultName();
57 
58  public:
59  static const std::string pose_provider_name;
60  static const std::string profile_provider_name;
61  static const std::string recognition_provider_name;
62 
63  protected:
64  /// @see PropertyUser::createPropertyDefinitions()
66 
67  /// @see armarx::ManagedIceObject::onInitComponent()
68  void onInitComponent() override;
69 
70  /// @see armarx::ManagedIceObject::onConnectComponent()
71  void onConnectComponent() override;
72 
73  /// @see armarx::ManagedIceObject::onDisconnectComponent()
74  void onDisconnectComponent() override;
75 
76  /// @see armarx::ManagedIceObject::onExitComponent()
77  void onExitComponent() override;
78 
79  private:
80  // main loop
81  void run();
82 
83  // main commands
84  void poseCommand();
85  void faceRecognitionCommand();
86  void profileCommand();
87 
88  // helpers
89  void commitProfile(std::string& name);
90  void commitFaceRecognition(Eigen::Vector3f& facePosition,
91  std::optional<armarx::armem::MemoryID> profileId);
92  void commitPose(Eigen::Vector3f& facePosition, std::string& humanId);
93 
94  // more helpers
95  std::optional<armarx::armem::MemoryID> findProfileId(std::string& entityId);
96 
97 
98  private:
99  // counts up when committing a face recognition. Is used to name the entities
100  unsigned int idCounter;
101  bool running;
102 
103  /// Properties shown in the Scenario GUI.
104  struct Properties
105  {
106  std::string robotName;
107  };
108 
109  Properties properties;
110 
111  // used to get readers/writers
113  };
114 
115 } // namespace VisionX::components::person_memory_debugger
visionx::components::person_memory_debugger
Definition: PersonMemoryDebugger.cpp:57
visionx::components::person_memory_debugger::PersonMemoryDebugger::getDefaultName
std::string getDefaultName() const override
Definition: PersonMemoryDebugger.cpp:343
MemoryID.h
visionx::components::person_memory_debugger::PersonMemoryDebugger::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PersonMemoryDebugger.cpp:65
visionx::components::person_memory_debugger::PersonMemoryDebugger::GetDefaultName
static std::string GetDefaultName()
Get the component's default name.
visionx::components::person_memory_debugger::PersonMemoryDebugger::profile_provider_name
static const std::string profile_provider_name
Definition: PersonMemoryDebugger.h:60
plugins.h
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:91
visionx::components::person_memory_debugger::PersonMemoryDebugger::onConnectComponent
void onConnectComponent() override
Definition: PersonMemoryDebugger.cpp:79
visionx::components::person_memory_debugger::PersonMemoryDebugger::onDisconnectComponent
void onDisconnectComponent() override
Definition: PersonMemoryDebugger.cpp:92
visionx::components::person_memory_debugger::PersonMemoryDebugger::onExitComponent
void onExitComponent() override
Definition: PersonMemoryDebugger.cpp:97
IceUtil::Handle< class PropertyDefinitionContainer >
visionx::components::person_memory_debugger::PersonMemoryDebugger
This component can be used for debugging of the person memory; more specifically it commits instances...
Definition: PersonMemoryDebugger.h:47
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:68
MemoryNameSystem.h
visionx::components::person_memory_debugger::PersonMemoryDebugger::onInitComponent
void onInitComponent() override
Definition: PersonMemoryDebugger.cpp:74
armarx::armem::client::plugins::ListeningPluginUser
A memory name system client which listens to the memory updates topic (MemoryListenerInterface).
Definition: ListeningPluginUser.h:21
visionx::components::person_memory_debugger::PersonMemoryDebugger::pose_provider_name
static const std::string pose_provider_name
Definition: PersonMemoryDebugger.h:59
ListeningPluginUser.h
visionx::components::person_memory_debugger::PersonMemoryDebugger::recognition_provider_name
static const std::string recognition_provider_name
Definition: PersonMemoryDebugger.h:61