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
bf0b081f
Commit
bf0b081f
authored
2 years ago
by
Corvin-N
Browse files
Options
Downloads
Patches
Plain Diff
Add comments to HumanFilter.cpp
parent
718cdbcd
No related branches found
No related tags found
3 merge requests
!68
Add human tracking
,
!53
Draft: Implement basic version of kalman filter for human tracking
,
!28
Draft: Dev -> Main
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/armarx/navigation/human/HumanFilter.cpp
+27
-1
27 additions, 1 deletion
source/armarx/navigation/human/HumanFilter.cpp
with
27 additions
and
1 deletion
source/armarx/navigation/human/HumanFilter.cpp
+
27
−
1
View file @
bf0b081f
...
...
@@ -3,6 +3,12 @@
namespace
armarx
::
navigation
::
human
{
/**
* @brief HumanFilter::HumanFilter creates a new filter that filters 2D poses (position and
* rotation in a two dimensional plane)
* @param pose0 the first known pose of the human
* @param detectionTime the point of detection
*/
HumanFilter
::
HumanFilter
(
const
core
::
Pose2D
&
pose0
,
const
DateTime
&
detectionTime
)
{
//initialize new human for detected human
...
...
@@ -12,7 +18,6 @@ namespace armarx::navigation::human
//initialize new kalman filter for new detected human
UnscentedKalmanFilter
<
SystemModelT
>::
PropCovT
Q
=
UnscentedKalmanFilter
<
SystemModelT
>::
PropCovT
::
Identity
();
Q
.
block
<
2
,
2
>
(
0
,
0
)
*=
params
.
control_pos_cov
*
params
.
control_pos_cov
;
...
...
@@ -37,6 +42,12 @@ namespace armarx::navigation::human
ukf
=
std
::
make_unique
<
UnscentedKalmanFilter
<
SystemModelT
>>
(
Q
,
R
,
alpha
,
state0
,
P0
);
}
/**
* @brief HumanFilter::propagation propagate the system model to the given point in time. This
* means that the human pose is updated according to the filters prediction for the given point
* in time
* @param detectionTime the point in time for which the pose should be predicted
*/
void
HumanFilter
::
propagation
(
const
armarx
::
core
::
time
::
DateTime
&
detectionTime
)
{
...
...
@@ -49,11 +60,18 @@ namespace armarx::navigation::human
human
.
pose
=
fromUkfState
(
ukf
->
getCurrentState
());
}
/**
* @brief HumanFilter::update update the filter a new detected pose of the tracked human and
* the detection time
* @param pose the new detected pose of the human
* @param detectionTime the detection time
*/
void
HumanFilter
::
update
(
const
core
::
Pose2D
&
pose
,
const
DateTime
&
detectionTime
)
{
double
dt
=
(
detectionTime
-
human
.
detectionTime
).
toSecondsDouble
();
//update ukf with new observation
SystemModelT
::
ObsT
observation
=
toUkfObs
(
pose
);
ukf
->
update
(
observation
);
...
...
@@ -62,14 +80,22 @@ namespace armarx::navigation::human
// calculate velocity
Eigen
::
Vector2f
ds
=
newPose
.
translation
()
-
oldPose
.
translation
();
Eigen
::
Vector2f
linVelocity
=
ds
/
dt
;
// apply exponential smoothing to velocity
//TODO try other approaches?
Eigen
::
Vector2f
newVelocity
=
params
.
velocityAlpha
*
linVelocity
+
(
1
-
params
.
velocityAlpha
)
*
human
.
linearVelocity
;
//update stored information about the human
human
.
detectionTime
=
detectionTime
;
human
.
pose
=
newPose
;
human
.
linearVelocity
=
newVelocity
;
}
/**
* @brief HumanFilter::get returns the human whose pose is filtered containing the most recent
* state
* @return the human
*/
const
Human
&
HumanFilter
::
get
()
const
{
...
...
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