CreateHumanPoseWithFaceRecognition.cpp
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::skills
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
24
28
30{
31
32 ::armarx::skills::SkillDescription
34 {
35 ParamType defaultParams;
36 defaultParams.profileEntityName = "John Handover";
37 defaultParams.humanId = "John Handover";
38 defaultParams.orientationDegreesClockwise = 0.F;
39 defaultParams.orientationFacesRobot = true;
40
41 const std::string skillName =
43 const armarx::skills::SkillID skillId =
45
46 return ::armarx::skills::SkillDescription{
47 .skillId = skillId,
48 .description = "Creates and commits a human pose with an attached face recognition for the profile specified in humanId. "
49 "Optionally, the pose can be set to face the robot.",
50 .rootProfileDefaults = defaultParams.toAron(),
51 .timeout = ::armarx::Duration::MilliSeconds(1000),
52 .parametersType = ParamType::ToAronType()};
53 }
54
61
63 CreateHumanPoseWithFaceRecognition::main(const SpecializedMainInput& in)
64 {
65 core::PersonSimulator simulator(remote, properties);
66
67 // create a pose, and then create a face recognition at the face position
68
70 if (in.parameters.orientationFacesRobot)
71 {
72 committedPose = simulator.createHumanPoseFacingRobot(in.parameters.humanId,
73 in.parameters.positionCartesian);
74 }
75 else
76 {
77 committedPose = simulator.createHumanPose(in.parameters.humanId,
78 in.parameters.positionCartesian,
79 in.parameters.orientationDegreesClockwise);
80 }
81
82 // we gain the committed pose from the simulator
83 // take position of face; create face recognition at that location
84 simulator.createFaceRecognition(committedPose.keypoints["Head"].positionGlobal->toEigen(),
85 in.parameters.humanId);
86
87 return Skill::MakeSucceededResult();
88 }
89
90} // namespace VisionX::person_simulator::skills
The core library for interaction with the person memory.
::armarx::skills::SimpleSpecializedSkill< ::VisionX::person_simulator::skills::arondto::CreateHumanPoseWithFaceRecognitionParams > Base
CreateHumanPoseWithFaceRecognition(const core::PersonSimulator::Remote &r, const core::PersonSimulator::Properties &p)
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition Duration.cpp:48
virtual MainResult main()
Override this method with the actual implementation.
Definition Skill.cpp:542
const std::string CreateHumanPoseWithFaceRecognition
Definition constants.h:33
const armarx::skills::SkillID CreateHumanPoseWithFaceRecognition
Definition skill_ids.h:34
Fixed properties of this skill implementation.
Remote parameters of this skill implementation.
A result struct for th main method of a skill.
Definition Skill.h:62