5 #include <SimoxUtility/algorithm/string.h>
14 std::optional<Eigen::Vector3f>
17 Eigen::Vector3f sumPosition = Eigen::Vector3f::Zero();
19 for (
const auto& [
id, keypoint] : humanPose.
keypoints)
25 sumPosition += keypoint.positionCamera.toEigen();
33 if (keypoint.positionGlobal)
35 sumPosition += keypoint.positionGlobal.value().toEigen();
42 if (keypoint.positionRobot)
44 sumPosition += keypoint.positionRobot.value().toEigen();
56 sumPosition.z() = 0.0;
57 return sumPosition / sumWeights;
60 std::optional<HumanPose>
64 std::optional<HumanPose> nearestHumanPose = std::nullopt;
65 double minDistance = std::numeric_limits<double>::infinity();
66 for (
const HumanPose& humanPose : humanPoses)
68 if (parameters.
modelIDs.empty() or parameters.
modelIDs.count(humanPose.poseModelId))
70 const std::optional<Eigen::Vector3f> meanPosition =
78 nearestHumanPose = humanPose;
86 return nearestHumanPose;
91 const std::string& prefix)
93 const std::string prefix_ = prefix +
"nearestHuman.";
95 positionMM.x(), prefix_ +
"position.x",
"Anchor position (x-coordinate) in mm.");
97 positionMM.y(), prefix_ +
"position.y",
"Anchor position (y-coordinate) in mm.");
99 positionMM.z(), prefix_ +
"position.z",
"Anchor position (z-coordinate) in mm.");
101 coordSystem, prefix_ +
"coordSystem",
"Coordinate system of the anchor position.")
106 .setCaseInsensitive(
true);
108 prefix_ +
"distanceThreshold",
109 "Optional minimum distance threshold in mm.");
111 modelIDs, prefix_ +
"allowedModelIDs",
"Allowed pose model ids, seperated by commas.");
124 modelIDs = std::set<std::string>(ids.begin(), ids.end());