56 remote(r), properties(p)
59 generatedPoseParams = {
61 .pelvisHeight = 1000.F,
62 .shoulderHeight = 1600.F,
78 armarx::human::arondto::Person dto;
79 armarx::human::arondto::PersonID id_dto;
80 toAron(id_dto, humanID);
86 .withProviderSegmentName(properties.profileProviderName)
87 .withEntityName(entityName);
91 .instancesData = {dto.toAron()},
98 ARMARX_INFO <<
"Committing profile with name: " << entityName;
102 std::optional<armarx::armem::MemoryID>
110 std::optional<armarx::armem::MemoryID> foundProfileId = std::nullopt;
122 if (foundProfileId.has_value())
131 foundProfileId = instance.
id();
135 return foundProfileId;
139 PersonSimulator::increaseAndConvert(
unsigned int& counter)
141 std::stringstream ss;
148 std::optional<std::string> entityName)
150 ARMARX_INFO <<
"Creating face recognition at cartesian position: " << facePosition.x()
151 <<
", " << facePosition.y() <<
", " << facePosition.z();
156 std::optional<armarx::armem::MemoryID> profileId = std::nullopt;
158 if (entityName.has_value())
171 armarx::human::arondto::FaceRecognition dto;
176 .withProviderSegmentName(properties.poseProviderName)
177 .withEntityName(entityName.value_or(increaseAndConvert(faceRecognitionIdCounter)));
180 .entityID = entityId,
181 .instancesData = {dto.toAron()},
190 <<
"Committing face recognition for profile: "
192 faceWriter.
commit(update);
197 Eigen::Vector2f meanFloorPosition,
198 float clockwiseOrientationDegrees)
200 ARMARX_INFO <<
"Creating human pose at cartesian position: " << meanFloorPosition.x()
201 <<
", " << meanFloorPosition.y();
211 Eigen::Quaternionf::UnitRandom(),
"global",
"Armar7");
216 constructDefaultKeypoints(std::move(meanFloorPosition), clockwiseOrientationDegrees);
220 .withEntityName(humanId);
222 armarx::human::arondto::HumanPose dto;
226 .entityID = entityId,
227 .instancesData = {dto.toAron()},
234 ARMARX_INFO <<
"Committing pose with PersonID '" << humanId <<
"'.";
235 poseWriter.
commit(update);
241 Eigen::Vector2f meanFloorPosition)
246 const auto robotPose =
248 const Eigen::Vector3f robotPosition = robotPose->translation();
250 Eigen::Vector2f robot2d{robotPosition.x(), robotPosition.y()};
251 Eigen::Vector2f diff = robot2d - meanFloorPosition;
253 Eigen::Vector2f forwards = Eigen::Vector2f::UnitY();
256 const float dot = diff.dot(forwards);
257 const float cos_angle =
dot;
258 float angle = acosf(cos_angle);
271 std::map<std::string, armarx::armem::human::PoseKeypoint>
272 PersonSimulator::constructDefaultKeypoints(Eigen::Vector2f meanFloorPosGlobal,
273 float clockwiseOrientationDegrees)
281 auto rotateGlobalVector =
282 [&clockwiseOrientationDegrees, &meanFloorPosGlobal](Eigen::Vector3f globalPosition)
285 const Eigen::Vector3f projectedMean(
286 meanFloorPosGlobal.x(), meanFloorPosGlobal.y(), 0.F);
288 Eigen::Vector3f verticalAxis = Eigen::Vector3f::UnitZ();
289 Eigen::AngleAxisf verticalAxisRotation = Eigen::AngleAxisf(
290 -1.F * simox::math::deg_to_rad(clockwiseOrientationDegrees), verticalAxis);
293 const Eigen::Vector3f localPosition = globalPosition - projectedMean;
295 const Eigen::Vector3f rotatedLocalPos =
296 verticalAxisRotation.toRotationMatrix() * localPosition;
298 const Eigen::Vector3f rotatedGlobalPos = rotatedLocalPos + projectedMean;
299 return rotatedGlobalPos;
305 auto setSymmetricJointsAtHeight = [&](std::string label,
float height)
308 const std::string left_sf =
"Left";
309 const std::string right_sf =
"Right";
311 Eigen::Vector3f leftPos =
313 meanFloorPosGlobal.y(),
315 Eigen::Vector3f rightPos =
317 meanFloorPosGlobal.y(),
319 leftPos = rotateGlobalVector(leftPos);
320 rightPos = rotateGlobalVector(rightPos);
321 keypoints[label + left_sf] = constructKeyPoint(leftPos, label + left_sf);
322 keypoints[label + right_sf] = constructKeyPoint(rightPos, label + right_sf);
326 auto setSingleJointAtHeight = [&](std::string label,
float height)
328 Eigen::Vector3f pos =
329 Eigen::Vector3f(meanFloorPosGlobal.x(), meanFloorPosGlobal.y(), height);
330 keypoints[label] = constructKeyPoint(pos, label);
336 keypoints[joint] = constructKeyPoint(
337 Eigen::Vector3f(meanFloorPosGlobal.x(), meanFloorPosGlobal.y(), 0.F), joint);
343 setSymmetricJointsAtHeight(
"Shoulder", generatedPoseParams.shoulderHeight);
346 setSymmetricJointsAtHeight(
"Hip", generatedPoseParams.hipHeight);
349 setSymmetricJointsAtHeight(
"Ear", generatedPoseParams.earHeight);
352 setSingleJointAtHeight(
"Pelvis", generatedPoseParams.pelvisHeight);
353 setSingleJointAtHeight(
"Head", generatedPoseParams.headHeight);
356 keypoints[
"WristRight"] = constructKeyPoint(
357 rotateGlobalVector({meanFloorPosGlobal.x() + properties.jointDisplacement,
358 meanFloorPosGlobal.y() + 100,
359 generatedPoseParams.hipHeight}),
366 armarx::armem::human::PoseKeypoint
367 PersonSimulator::constructKeyPoint(Eigen::Vector3f globalPos,
const std::string& label)
370 auto makeDefaultOrientation = [&](std::string frameName)
372 return armarx::FramedOrientation(
373 Eigen::Quaternionf::Identity(), frameName, properties.robotName);
375 auto makeDefaultPosition = [&](std::string frameName)
377 Eigen::Vector3f ident = Eigen::Vector3f::Identity();
378 return armarx::FramedPosition(ident, frameName, properties.robotName);
382 armarx::armem::human::PoseKeypoint key = {
385 .positionCamera = makeDefaultPosition(
"camera"),
386 .orientationCamera = makeDefaultOrientation(
"camera"),
387 .positionRobot = makeDefaultPosition(
"robot"),
388 .orientationRobot = makeDefaultOrientation(
"robot"),
389 .positionGlobal = armarx::FramedPosition(globalPos,
"global", properties.robotName),
390 .orientationGlobal = makeDefaultOrientation(
"global"),
const simox::meta::EnumNames< Joints > JointNames
Names of the joints as defined in the body model.