diff options
-rw-r--r-- | ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 34ac0dca..195dd760 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -225,9 +225,9 @@ void FTNoIR_Tracker::GetHeadPoseData(double *data) auto mid = (min_[idx] + max_[idx]) / 2; auto val = values[idx] - mid; - auto max = (max_[idx] - min_[idx]) / 2; - auto min = (min_[idx] - max_[idx]) / -2; - data[i] = val * limits[i] / (double) (val >= 0 ? max : min); + auto max = (max_[idx] - mid) * 2; + auto min = (mid - min_[idx]) * 2; + data[i] = val * limits[i] / (double) (val > mid ? max : min); } } } |