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
50d0594d
Commit
50d0594d
authored
2 years ago
by
Corvin-N
Browse files
Options
Downloads
Patches
Plain Diff
Fix calculation of humans rotation
parent
bfa269f6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/armarx/navigation/human/HumanTracker.cpp
+9
-11
9 additions, 11 deletions
source/armarx/navigation/human/HumanTracker.cpp
with
9 additions
and
11 deletions
source/armarx/navigation/human/HumanTracker.cpp
+
9
−
11
View file @
50d0594d
...
...
@@ -32,18 +32,16 @@ namespace armarx::navigation::human
double
yaw
=
0
;
if
(
humanPose
.
keypoints
.
count
(
"HEAD"
)
>
0
)
{
Eigen
::
Quaternionf
qhead
=
humanPose
.
keypoints
.
at
(
"HEAD"
).
orientationGlobal
->
toEigenQuaternion
();
//TODO not quite sure if the quaternion operates this way as it is not further defined
// on https://learn.microsoft.com/de-de/azure/kinect-dk/body-joints
Eigen
::
Vector3f
vec
(
0
,
1
,
0
);
const
armem
::
human
::
PoseKeypoint
&
headKeypoint
=
humanPose
.
keypoints
.
at
(
"HEAD"
);
ARMARX_CHECK
(
headKeypoint
.
orientationGlobal
.
has_value
());
Eigen
::
Quaternionf
qhead
=
headKeypoint
.
orientationGlobal
->
toEigenQuaternion
();
Eigen
::
Vector3f
vec
(
1
,
0
,
0
);
Eigen
::
Vector3f
rot3
=
qhead
.
_transformVector
(
vec
);
Eigen
::
Vector2f
rot2
(
rot3
.
y
(),
rot3
.
z
());
Eigen
::
Vector2f
rot2
(
rot3
.
x
(),
rot3
.
y
());
if
(
rot2
.
norm
()
!=
0
)
{
rot2
.
normalize
();
// calculate angle between e1 and rot2
yaw
=
atan2
(
rot2
.
y
(),
rot2
.
x
()
*
rot2
.
y
());
// calculate angle of rot2
yaw
=
atan2
(
rot2
.
y
(),
rot2
.
x
());
}
//old version using euler angles:
//yaw = humanPose //from all human pose keypoints
...
...
@@ -51,8 +49,8 @@ namespace armarx::navigation::human
// .at("HEAD") //find the keypoint representing the head
// .orientationGlobal //get its global orientation
// ->toEigen()
// .eulerAngles(2, 1, 0)[
2
]; //and extract the yaw (rotation around
x
axis
//
should be z axis in
global coordinates)
// .eulerAngles(2, 1, 0)[
0
]; //and extract the yaw (rotation around
z
axis
in
//
global coordinates)
}
// create the new pose with the calculated position and yaw
...
...
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