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
a073a121
Commit
a073a121
authored
2 years ago
by
Corvin-N
Browse files
Options
Downloads
Patches
Plain Diff
Make getSortedDistances a class method
parent
cdcf9d01
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!68
Add human tracking
,
!53
Draft: Implement basic version of kalman filter for 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
+38
-46
38 additions, 46 deletions
source/armarx/navigation/human/HumanTracker.cpp
source/armarx/navigation/human/HumanTracker.h
+19
-0
19 additions, 0 deletions
source/armarx/navigation/human/HumanTracker.h
with
57 additions
and
46 deletions
source/armarx/navigation/human/HumanTracker.cpp
+
38
−
46
View file @
a073a121
...
@@ -73,51 +73,6 @@ namespace armarx::navigation::human
...
@@ -73,51 +73,6 @@ namespace armarx::navigation::human
}
}
struct
PosDistance
{
HumanTracker
::
TrackedHuman
*
oldHuman
;
HumanTracker
::
DetectedHuman
*
newHuman
;
float
distance
;
};
std
::
vector
<
PosDistance
>
getSortedDistances
(
std
::
vector
<
HumanTracker
::
TrackedHuman
>&
oldHumans
,
std
::
vector
<
HumanTracker
::
DetectedHuman
>&
newHumans
)
{
std
::
vector
<
PosDistance
>
posDistances
;
for
(
auto
&
oldHuman
:
oldHumans
)
{
if
(
oldHuman
.
associated
)
{
continue
;
}
for
(
auto
&
newHuman
:
newHumans
)
{
if
(
newHuman
.
associated
)
{
continue
;
}
// calculate distance between every possible combination of tracked and detected
// humans where none of them was associated
posDistances
.
push_back
(
{
&
oldHuman
,
&
newHuman
,
(
newHuman
.
pose
.
translation
()
-
oldHuman
.
humanFilter
.
get
().
pose
.
translation
())
.
norm
()});
}
}
// sort the distances ascending by their numeric value
std
::
sort
(
posDistances
.
begin
(),
posDistances
.
end
(),
[](
const
PosDistance
&
a
,
const
PosDistance
&
b
)
->
bool
{
return
a
.
distance
<
b
.
distance
;
});
return
posDistances
;
}
HumanTracker
::
DetectedHuman
HumanTracker
::
DetectedHuman
HumanTracker
::
convertHumanPoseToDetectedHuman
(
const
DateTime
&
time
,
HumanTracker
::
convertHumanPoseToDetectedHuman
(
const
DateTime
&
time
,
const
armem
::
human
::
HumanPose
&
humanPose
)
const
armem
::
human
::
HumanPose
&
humanPose
)
...
@@ -157,7 +112,7 @@ namespace armarx::navigation::human
...
@@ -157,7 +112,7 @@ namespace armarx::navigation::human
//old version using euler angles:
//old version using euler angles:
//yaw = humanPose //from all human pose keypoints
//yaw = humanPose //from all human pose keypoints
// .keypoints
// .keypoints
// .at(
"HEAD"
) //find the keypoint representing the head
// .at(
parameters.rotationKeypoint
) //find the keypoint representing the head
// .orientationGlobal //get its global orientation
// .orientationGlobal //get its global orientation
// ->toEigen()
// ->toEigen()
// .eulerAngles(2, 1, 0)[0]; //and extract the yaw (rotation around z axis in
// .eulerAngles(2, 1, 0)[0]; //and extract the yaw (rotation around z axis in
...
@@ -172,6 +127,43 @@ namespace armarx::navigation::human
...
@@ -172,6 +127,43 @@ namespace armarx::navigation::human
return
{
pose
,
humanPose
.
humanTrackingId
,
time
,
false
};
return
{
pose
,
humanPose
.
humanTrackingId
,
time
,
false
};
}
}
std
::
vector
<
HumanTracker
::
PosDistance
>
HumanTracker
::
getSortedDistances
(
std
::
vector
<
HumanTracker
::
TrackedHuman
>&
oldHumans
,
std
::
vector
<
HumanTracker
::
DetectedHuman
>&
newHumans
)
{
std
::
vector
<
PosDistance
>
posDistances
;
for
(
auto
&
oldHuman
:
oldHumans
)
{
if
(
oldHuman
.
associated
)
{
continue
;
}
for
(
auto
&
newHuman
:
newHumans
)
{
if
(
newHuman
.
associated
)
{
continue
;
}
// calculate distance between every possible combination of tracked and detected
// humans where none of them was associated
posDistances
.
push_back
(
{
&
oldHuman
,
&
newHuman
,
(
newHuman
.
pose
.
translation
()
-
oldHuman
.
humanFilter
.
get
().
pose
.
translation
())
.
norm
()});
}
}
// sort the distances ascending by their numeric value
std
::
sort
(
posDistances
.
begin
(),
posDistances
.
end
(),
[](
const
PosDistance
&
a
,
const
PosDistance
&
b
)
->
bool
{
return
a
.
distance
<
b
.
distance
;
});
return
posDistances
;
}
void
void
HumanTracker
::
associateHumans
(
std
::
vector
<
DetectedHuman
>&
detectedHumans
)
HumanTracker
::
associateHumans
(
std
::
vector
<
DetectedHuman
>&
detectedHumans
)
{
{
...
...
This diff is collapsed.
Click to expand it.
source/armarx/navigation/human/HumanTracker.h
+
19
−
0
View file @
a073a121
...
@@ -71,6 +71,13 @@ namespace armarx::navigation::human
...
@@ -71,6 +71,13 @@ namespace armarx::navigation::human
bool
associated
;
bool
associated
;
};
};
struct
PosDistance
{
HumanTracker
::
TrackedHuman
*
oldHuman
;
HumanTracker
::
DetectedHuman
*
newHuman
;
float
distance
;
};
struct
Parameters
struct
Parameters
{
{
// the keypoint which should be used for calculating the rotation of the humans
// the keypoint which should be used for calculating the rotation of the humans
...
@@ -115,6 +122,18 @@ namespace armarx::navigation::human
...
@@ -115,6 +122,18 @@ namespace armarx::navigation::human
*/
*/
DetectedHuman
convertHumanPoseToDetectedHuman
(
const
DateTime
&
time
,
DetectedHuman
convertHumanPoseToDetectedHuman
(
const
DateTime
&
time
,
const
armem
::
human
::
HumanPose
&
humanPose
);
const
armem
::
human
::
HumanPose
&
humanPose
);
/**
* @brief getSortedDistances Returns a sorted vector of the distances between every possible
* combination (T, D) where T is an old, tracked human and D is a new, detected human and
* both of them are not already associated. The smallest distance will be the first entry in
* the vector
* @param oldHumans the old, tracked humans
* @param newHumans the new, detected humans
* @return the sorted vector of distances with references to the according humans
*/
std
::
vector
<
PosDistance
>
getSortedDistances
(
std
::
vector
<
HumanTracker
::
TrackedHuman
>&
oldHumans
,
std
::
vector
<
HumanTracker
::
DetectedHuman
>&
newHumans
);
/**
/**
* @brief HumanTracker::associateHumans Associates those tracked and detected humans that
* @brief HumanTracker::associateHumans Associates those tracked and detected humans that
* belong together.
* belong together.
...
...
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