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