d/wmr: Compare angle of gravity swing directly in correspondence_search

Ignore the swing vector and only conside the swing angle for gravity
alignment checks
This commit is contained in:
Jan Schmidt committed 2026-03-25 17:50:33 +11:00
1 parent c96cd7a344
commit ff73bc2d45
1 file changed
+2 -1
@@ -281,7 +281,8 @@ correspondence_search_project_pose(struct correspondence_search *cs,
math_quat_decompose_swing_twist(&pose->orientation, &mi->gravity_vector, &pose_gravity_swing,
&pose_gravity_twist);
float pose_angle = acosf(math_quat_dot(&pose_gravity_swing, &mi->gravity_swing));
// Calculate the difference between the amount of gravity swing, ignoring axis
float pose_angle = fabs(acosf(pose_gravity_swing.w)) - fabs(acosf(mi->gravity_swing.w));
if (pose_angle > mi->gravity_tolerance_rad) {
DEBUG(
"model %d failed pose match - orientation was not within tolerance (error %f deg > %f "