Skip to content
Snippets Groups Projects
Commit 7224a74c authored by Corvin-N's avatar Corvin-N
Browse files

Use ellipsoids saved in clusters instead of iterating over points

parent 482aee62
No related branches found
No related tags found
2 merge requests!68Add human tracking,!28Draft: Dev -> Main
...@@ -59,13 +59,7 @@ namespace armarx::navigation::human ...@@ -59,13 +59,7 @@ namespace armarx::navigation::human
if (getClusterSize(cluster) <= 2 * parameters.maxFootprintSize) if (getClusterSize(cluster) <= 2 * parameters.maxFootprintSize)
{ {
//calculate center of cluster Eigen::Vector2f clusterCenter = cluster.ellipsoid.pose.translation();
Eigen::Vector2f clusterCenter;
for (auto& point : cluster.points)
{
clusterCenter += point;
}
clusterCenter /= cluster.points.size();
potentialFootprints.push_back(AdvancedCluster{ potentialFootprints.push_back(AdvancedCluster{
.center = clusterCenter, .cluster = cluster, .associated = false}); .center = clusterCenter, .cluster = cluster, .associated = false});
...@@ -99,21 +93,13 @@ namespace armarx::navigation::human ...@@ -99,21 +93,13 @@ namespace armarx::navigation::human
// found both footprints, so associate both footprints and update human with new pose // found both footprints, so associate both footprints and update human with new pose
else else
{ {
//calculate center of the points of both footprints combined //calculate center between both footprints
auto& footprint1 = posDistance.oldHuman->associatedCluster->cluster.points; auto& footprint1 = posDistance.oldHuman->associatedCluster->cluster;
auto& footprint2 = posDistance.newCluster->cluster.points; auto& footprint2 = posDistance.newCluster->cluster;
//TODO more efficient by just calculating mean between two circle centers for example Eigen::Vector2f centerPos = (footprint1.ellipsoid.pose.translation() +
Eigen::Vector2f centerPos; footprint2.ellipsoid.pose.translation()) /
for (auto& point : footprint1) 2;
{
centerPos += point;
}
for (auto& point : footprint2)
{
centerPos += point;
}
centerPos /= (footprint1.size() + footprint2.size());
//create pose with orientation from old human //create pose with orientation from old human
core::Pose2D pose = core::Pose2D::Identity(); core::Pose2D pose = core::Pose2D::Identity();
...@@ -357,18 +343,7 @@ namespace armarx::navigation::human ...@@ -357,18 +343,7 @@ namespace armarx::navigation::human
float float
HumanTracker::getClusterSize(Cluster cluster) HumanTracker::getClusterSize(Cluster cluster)
{ {
//TODO more effictient by using radius of circle saved in cluster for example return std::max(cluster.ellipsoid.radii.x(), cluster.ellipsoid.radii.y());
float maxSize = 0;
for (auto it1 = cluster.points.begin(); it1 != cluster.points.end();)
{
auto& point1 = *it1;
for (auto it2 = it1 + 1; it2 != cluster.points.end();)
{
auto& point2 = *it2;
maxSize = std::max(maxSize, (point2 - point1).norm());
}
}
return maxSize;
} }
void void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment