PersonSimulator.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::COMPONENT_NAME_SNAKE::core
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 #pragma once
24 
25 #include <Eigen/Geometry>
26 
27 #include <VirtualRobot/VirtualRobot.h>
28 
34 
36 
38 {
39  /**
40  * @class PersonSimulator
41  * @brief The core library for interaction with the person memory. Provides functions for creation and updating of entries.
42  */
44  {
45  public:
46  /// Remote parameters of this skill implementation
47  struct Remote
48  {
49  // for interaction with memory
51  // for robot position
53  };
54 
55  /// Fixed properties of this skill implementation
56  struct Properties
57  {
58  // the name of the robot, for camera frames
59  std::string robotName;
60  // the poseModelId to use for new poses
61  std::string poseModelId;
62  std::string profileProviderName;
63  std::string poseProviderName;
65  };
66 
68  {
69  float hipHeight;
70  float pelvisHeight;
72  float headHeight;
73  float earHeight;
74  };
75 
76  /// Constructor of this skill implementation
77  PersonSimulator(const Remote& r, const Properties& p);
78 
79  // API
80  // note: robot name is specified in properties
81  void createHumanProfile(const std::string& profileName);
82  void createFaceRecognition(const Eigen::Vector3f& facePosition,
83  std::optional<std::string> entityName);
84 
85  /// return values are copies of the committed poses, needed for creating a pose+facerecognition
86  armarx::armem::human::HumanPose createHumanPose(const std::string& humanId,
87  Eigen::Vector2f meanFloorPosition,
88  float clockwiseOrientationDegrees);
90  createHumanPoseFacingRobot(const std::string& humanId, Eigen::Vector2f meanFloorPosition);
91 
92  std::optional<armarx::armem::MemoryID> findProfileId(std::string& entityId);
93 
94  private:
95  Remote remote;
96  Properties properties;
97  GeneratedPoseParams generatedPoseParams;
98 
99  unsigned int faceRecognitionIdCounter = 0;
100 
101  static std::string increaseAndConvert(unsigned int& counter);
102 
103  /// Constructs the "default" pose with partially incomplete keypoints (see "constructKeyPoint")
104  std::map<std::string, armarx::armem::human::PoseKeypoint>
105  constructDefaultKeypoints(Eigen::Vector2f meanFloorPosGlobal,
106  float clockwiseOrientationDegrees);
107 
108  /// Constructs a keypoint at a given position. Only the global position is set; everything else is an identity.
109  armarx::armem::human::PoseKeypoint constructKeyPoint(Eigen::Vector3f globalPos,
110  const std::string& label);
111  };
112 
113 } // namespace VisionX::person_simulator::core
armarx::armem::robot_state::VirtualRobotReader
The VirtualRobotReader class.
Definition: VirtualRobotReader.h:39
VisionX::person_simulator::core
Definition: PersonSimulator.cpp:53
VisionX::person_simulator::core::PersonSimulator::createFaceRecognition
void createFaceRecognition(const Eigen::Vector3f &facePosition, std::optional< std::string > entityName)
Definition: PersonSimulator.cpp:144
VisionX::person_simulator::core::PersonSimulator::createHumanPoseFacingRobot
armarx::armem::human::HumanPose createHumanPoseFacingRobot(const std::string &humanId, Eigen::Vector2f meanFloorPosition)
Definition: PersonSimulator.cpp:236
Writer.h
VisionX::person_simulator::core::PersonSimulator::findProfileId
std::optional< armarx::armem::MemoryID > findProfileId(std::string &entityId)
Definition: PersonSimulator.cpp:100
VisionX::person_simulator::core::PersonSimulator::Properties::poseProviderName
std::string poseProviderName
Definition: PersonSimulator.h:63
ReaderWriterPlugin.h
VisionX::person_simulator::core::PersonSimulator::Properties
Fixed properties of this skill implementation.
Definition: PersonSimulator.h:56
VisionX::person_simulator::core::PersonSimulator::GeneratedPoseParams::headHeight
float headHeight
Definition: PersonSimulator.h:72
VisionX::person_simulator::core::PersonSimulator::Properties::robotName
std::string robotName
Definition: PersonSimulator.h:59
armarx::armem::human::PoseKeypoint
Definition: types.h:17
types.h
VisionX::person_simulator::core::PersonSimulator::Properties::profileProviderName
std::string profileProviderName
Definition: PersonSimulator.h:62
VisionX::person_simulator::core::PersonSimulator::Remote
Remote parameters of this skill implementation.
Definition: PersonSimulator.h:47
VisionX::person_simulator::core::PersonSimulator
The core library for interaction with the person memory. Provides functions for creation and updating...
Definition: PersonSimulator.h:43
VisionX::person_simulator::core::PersonSimulator::Properties::poseModelId
std::string poseModelId
Definition: PersonSimulator.h:61
VisionX::person_simulator::core::PersonSimulator::Remote::robotReader
armarx::armem::robot_state::VirtualRobotReader & robotReader
Definition: PersonSimulator.h:52
VisionX::person_simulator::core::PersonSimulator::Remote::mns
armarx::armem::client::MemoryNameSystem mns
Definition: PersonSimulator.h:50
VisionX::person_simulator::core::PersonSimulator::GeneratedPoseParams::shoulderHeight
float shoulderHeight
Definition: PersonSimulator.h:71
RobotReader.h
VirtualRobotReader.h
armarx::armem::human::HumanPose
Definition: types.h:30
VisionX::person_simulator::core::PersonSimulator::Properties::jointDisplacement
float jointDisplacement
Definition: PersonSimulator.h:64
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:68
VisionX::person_simulator::core::PersonSimulator::GeneratedPoseParams::earHeight
float earHeight
Definition: PersonSimulator.h:73
MemoryNameSystem.h
VisionX::person_simulator::core::PersonSimulator::GeneratedPoseParams::hipHeight
float hipHeight
Definition: PersonSimulator.h:69
VisionX::person_simulator::core::PersonSimulator::GeneratedPoseParams
Definition: PersonSimulator.h:67
VisionX::person_simulator::core::PersonSimulator::PersonSimulator
PersonSimulator(const Remote &r, const Properties &p)
Constructor of this skill implementation.
Definition: PersonSimulator.cpp:55
VisionX::person_simulator::core::PersonSimulator::createHumanPose
armarx::armem::human::HumanPose createHumanPose(const std::string &humanId, Eigen::Vector2f meanFloorPosition, float clockwiseOrientationDegrees)
return values are copies of the committed poses, needed for creating a pose+facerecognition
Definition: PersonSimulator.cpp:192
VisionX::person_simulator::core::PersonSimulator::createHumanProfile
void createHumanProfile(const std::string &profileName)
Definition: PersonSimulator.cpp:69
VisionX::person_simulator::core::PersonSimulator::GeneratedPoseParams::pelvisHeight
float pelvisHeight
Definition: PersonSimulator.h:70