Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Navigation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
Skills
Navigation
Commits
05615bb8
Commit
05615bb8
authored
2 years ago
by
Corvin-N
Browse files
Options
Downloads
Patches
Plain Diff
Extract preparation of trackedHumans for association in extra method
parent
26182499
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!68
Add human tracking
,
!28
Draft: Dev -> Main
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/armarx/navigation/human/HumanTracker.cpp
+28
-30
28 additions, 30 deletions
source/armarx/navigation/human/HumanTracker.cpp
source/armarx/navigation/human/HumanTracker.h
+14
-2
14 additions, 2 deletions
source/armarx/navigation/human/HumanTracker.h
with
42 additions
and
32 deletions
source/armarx/navigation/human/HumanTracker.cpp
+
28
−
30
View file @
05615bb8
...
@@ -12,24 +12,7 @@ namespace armarx::navigation::human
...
@@ -12,24 +12,7 @@ namespace armarx::navigation::human
void
void
HumanTracker
::
update
(
const
CameraMeasurement
&
measurements
)
HumanTracker
::
update
(
const
CameraMeasurement
&
measurements
)
{
{
// iterate over all existing tracked humans
prepareTrackedHumans
(
measurements
.
detectionTime
);
for
(
auto
it
=
trackedHumans
.
begin
();
it
!=
trackedHumans
.
end
();)
{
auto
&
human
=
*
it
;
// when the tracked human recieved no new measurement for too long, remove it
if
((
measurements
.
detectionTime
-
human
.
humanFilter
.
get
().
detectionTime
)
>=
parameters
.
maxTrackingAge
)
{
it
=
trackedHumans
.
erase
(
it
);
}
// otherwise the tracked human is prepared for association at the current point in time
else
{
human
.
associated
=
false
;
human
.
humanFilter
.
propagation
(
measurements
.
detectionTime
);
it
++
;
}
}
// calculate the poses according to the new received measurements
// calculate the poses according to the new received measurements
std
::
vector
<
DetectedHuman
>
newPoses
=
std
::
vector
<
DetectedHuman
>
newPoses
=
...
@@ -166,27 +149,19 @@ namespace armarx::navigation::human
...
@@ -166,27 +149,19 @@ namespace armarx::navigation::human
std
::
vector
<
HumanTracker
::
PosLaserDistance
>
std
::
vector
<
HumanTracker
::
PosLaserDistance
>
HumanTracker
::
getSortedDistances
(
std
::
vector
<
TrackedHuman
>&
oldHumans
,
HumanTracker
::
getSortedDistances
(
std
::
vector
<
TrackedHuman
>&
oldHumans
,
std
::
vector
<
Cluster
>&
newClusters
)
std
::
vector
<
Advanced
Cluster
>&
newClusters
)
{
{
std
::
vector
<
PosLaserDistance
>
posDistances
;
std
::
vector
<
PosLaserDistance
>
posDistances
;
for
(
auto
&
newCluster
:
newCluster
s
)
for
(
auto
&
oldHuman
:
oldHuman
s
)
{
{
//calculate center of cluster
for
(
auto
&
newCluster
:
newClusters
)
Eigen
::
Vector2f
clusterCenter
;
for
(
auto
&
point
:
newCluster
.
points
)
{
clusterCenter
+=
point
;
}
clusterCenter
/=
newCluster
.
points
.
size
();
for
(
auto
&
oldHuman
:
oldHumans
)
{
{
// calculate distance between every possible combination of tracked human and cluster
// calculate distance between every possible combination of tracked human and cluster
posDistances
.
push_back
(
posDistances
.
push_back
(
{
&
oldHuman
,
{
&
oldHuman
,
&
newCluster
,
&
newCluster
,
(
c
luster
C
enter
-
oldHuman
.
humanFilter
.
get
().
pose
.
translation
()).
norm
()});
(
newC
luster
.
c
enter
-
oldHuman
.
humanFilter
.
get
().
pose
.
translation
()).
norm
()});
}
}
}
}
...
@@ -272,4 +247,27 @@ namespace armarx::navigation::human
...
@@ -272,4 +247,27 @@ namespace armarx::navigation::human
return
maxSize
;
return
maxSize
;
}
}
void
HumanTracker
::
prepareTrackedHumans
(
DateTime
time
)
{
// iterate over all existing tracked humans
for
(
auto
it
=
trackedHumans
.
begin
();
it
!=
trackedHumans
.
end
();)
{
auto
&
human
=
*
it
;
// when the tracked human recieved no new measurement for too long, remove it
if
((
time
-
human
.
humanFilter
.
get
().
detectionTime
)
>=
parameters
.
maxTrackingAge
)
{
it
=
trackedHumans
.
erase
(
it
);
}
// otherwise the tracked human is prepared for association at the current point in time
else
{
human
.
associatedClusters
=
0
;
human
.
associated
=
false
;
human
.
humanFilter
.
propagation
(
time
);
it
++
;
}
}
}
}
// namespace armarx::navigation::human
}
// namespace armarx::navigation::human
This diff is collapsed.
Click to expand it.
source/armarx/navigation/human/HumanTracker.h
+
14
−
2
View file @
05615bb8
...
@@ -76,6 +76,14 @@ namespace armarx::navigation::human
...
@@ -76,6 +76,14 @@ namespace armarx::navigation::human
{
{
HumanFilter
humanFilter
;
HumanFilter
humanFilter
;
std
::
optional
<
std
::
string
>
trackingId
=
std
::
nullopt
;
std
::
optional
<
std
::
string
>
trackingId
=
std
::
nullopt
;
int
associatedClusters
;
bool
associated
;
};
struct
AdvancedCluster
{
Eigen
::
Vector2f
center
;
Cluster
cluster
;
bool
associated
;
bool
associated
;
};
};
...
@@ -89,7 +97,7 @@ namespace armarx::navigation::human
...
@@ -89,7 +97,7 @@ namespace armarx::navigation::human
struct
PosLaserDistance
struct
PosLaserDistance
{
{
HumanTracker
::
TrackedHuman
*
oldHuman
;
HumanTracker
::
TrackedHuman
*
oldHuman
;
Cluster
*
newCluster
;
Advanced
Cluster
*
newCluster
;
float
distance
;
float
distance
;
};
};
...
@@ -172,7 +180,7 @@ namespace armarx::navigation::human
...
@@ -172,7 +180,7 @@ namespace armarx::navigation::human
*/
*/
std
::
vector
<
PosLaserDistance
>
std
::
vector
<
PosLaserDistance
>
getSortedDistances
(
std
::
vector
<
HumanTracker
::
TrackedHuman
>&
oldHumans
,
getSortedDistances
(
std
::
vector
<
HumanTracker
::
TrackedHuman
>&
oldHumans
,
std
::
vector
<
Cluster
>&
newClusters
);
std
::
vector
<
Advanced
Cluster
>&
newClusters
);
/**
/**
* @brief HumanTracker::associateHumans Associates those tracked and detected humans that
* @brief HumanTracker::associateHumans Associates those tracked and detected humans that
* belong together.
* belong together.
...
@@ -194,6 +202,10 @@ namespace armarx::navigation::human
...
@@ -194,6 +202,10 @@ namespace armarx::navigation::human
* @return the size
* @return the size
*/
*/
float
getClusterSize
(
Cluster
cluster
);
float
getClusterSize
(
Cluster
cluster
);
/**
* @brief prepareTrackedHumans
*/
void
prepareTrackedHumans
(
DateTime
time
);
private
:
private
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment