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
40
42{
43
44 /**
45 * This component can be used for debugging of the person memory; more specifically it commits instances
46 * into the person memory based on user input. This is useful to provoce certain cases.\n
47 * The component must be started inside a terminal. The HumanMemory should be running.\n
48 * Important: do not use this in a real environment, as it most certainly will lead to unexpected behaviour.
49 * Do not depend on the data supplied here, it is mostly incoherent.
50 */
52 virtual public armarx::Component,
54 {
55 public:
56 /// @see armarx::ManagedIceObject::getDefaultName()
57 std::string getDefaultName() const override;
58
59 /// Get the component's default name.
60 static std::string GetDefaultName();
61
62 public:
63 static const std::string pose_provider_name;
64 static const std::string profile_provider_name;
65 static const std::string recognition_provider_name;
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 private:
84 // main loop
85 void run();
86
87 // main commands
88 void poseCommand();
89 void faceRecognitionCommand();
90 void profileCommand();
91 void readProfileCommand();
92 void readPreferencesCommand();
93 void readDrinkPreferenceCommand();
94 void setDrinkPreferenceCommand();
95 void writeNewPreferencesCommand();
96 void setCustomAttributeCommand();
97 void createPersonInstanceCommand();
98
99 // helpers
100 void commitProfile(armarx::armem::human::PersonID& personID);
101 void commitFaceRecognition(Eigen::Vector3f& facePosition,
102 std::optional<armarx::armem::MemoryID> profileId);
103 void commitPose(Eigen::Vector3f& facePosition, std::string& humanId);
104 void readProfile(const std::string& firstName, const std::string& lastName);
105 void readPreferences(const std::string& firstName, const std::string& lastName);
106 void readDrinkPreference(const std::string& firstName, const std::string& lastName);
107 void setDrinkPreference(const std::string& firstName, const std::string& lastName, const std::string& drink);
108 void writeNewPreferences(const std::string& firstName, const std::string& lastName);
109 void setCustomAttribute(const std::string& firstName, const std::string& lastName);
110 void createPersonInstance(const std::string& firstName, const std::string& lastName);
111
112 // more helpers
113 std::optional<armarx::armem::MemoryID> findProfileId(std::string& entityId);
114
115
116 private:
117 // counts up when committing a face recognition. Is used to name the entities
118 unsigned int idCounter;
119 bool running;
120
121 /// Properties shown in the Scenario GUI.
122 struct Properties
123 {
124 std::string robotName;
125 };
126
127 Properties properties;
128
129 // used to get readers/writers
132 };
133
134} // namespace visionx::components::person_memory_debugger
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
This component can be used for debugging of the person memory; more specifically it commits instances...
static std::string GetDefaultName()
Get the component's default name.
plugins::ListeningPluginUser ComponentPluginUser
Definition plugins.h:10
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.