AIRLegend / aitrack

6DoF Head tracking software
MIT License
1.03k stars 102 forks source link

Rotation values #160

Closed jonipokka closed 1 year ago

jonipokka commented 1 year ago

Describe the bug There seems to be a problem with roll values. I read from the patch notes that the values are capped at +-90 but the issue is that the default value that opentrack picks up is 90 and roll only works in one direction (changing offsets etc in opentrack do nothing).

Since the default value that aitrack seems to send is 90 when my head is straight, and the values are capped at +-90 cause the roll to only work one way. When I tilt my head right the roll works the value decreases 87....86....83... Etc in opentrack but when I tilt my head left the value stays at 90 and nothing happens.

To Reproduce Steps to reproduce the behavior: Start the program and follow instructions to use aitrack with opentrack. Default settings in opentrack.

Expected behavior As my head seems to be recognized correctly since everything else works wonderfully (yaw, pitch, xyz) and aitrack draws the shape lines on my face correctly I expect the roll feature to work aswell in both directions and not only when rolling to one side.

Environment (please complete the following information):

searching46dof commented 1 year ago

I cofirmed the behavior.

Roll should be limited between 0.0 and 180.0 and v0.6.6 is coded as: // Limit roll between -90.0 and +90.0 if (face_data.rotation[2] >= 90.0) face_data.rotation[2] = 90.0; else if (face_data.rotation[2] <= -90.0) face_data.rotation[2] = -90.0;

I submitted the changes to restrict only yaw and pitch when they were initially exceeding +/-90deg which did not make sense since my face would be looking away from the camera. Roll did not have this issue and was not a problem since it would lose face tracking at +/-45deg from center (90deg).

I would recommend adding code to show the restrictions but leaving them #ifdef'd out for performance. It can be re-enabled if needed.

if 0

// Limit roll between -90.0 and +90.0 from center (=90deg)
if (face_data.rotation[2] > 180.0)
    face_data.rotation[2] = 180.0;
else if (face_data.rotation[2] < 0.0)
    face_data.rotation[2] = 0.0;

endif

AIRLegend commented 1 year ago

Yup. The problem is with the range.

I think it's better to simply fix the range (set the clipping for roll to 0-180) instead of trusting the face detector will lose track at 45º as we could change the detectors in the future.

@searching46dof's proposal is the fix. I'll change it as soon as I can.

AIRLegend commented 1 year ago

Fixed on #163