diff options
-rw-r--r-- | .github/workflows/cmake.yml | 10 | ||||
-rw-r--r-- | proto-libevdev/ftnoir_protocol_libevdev.cpp | 5 | ||||
-rw-r--r-- | tracker-neuralnet/ftnoir_tracker_neuralnet.cpp | 10 |
3 files changed, 18 insertions, 7 deletions
diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 96f509e5..fc53f6d7 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -59,8 +59,8 @@ jobs: - name: Build run: ${{matrix.cmake}} --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target install - - name: Upload build - uses: actions/upload-artifact@v3 - with: - name: buildoutput - path: ${{github.workspace}}/build/ +# - name: Upload build +# uses: actions/upload-artifact@v3 +# with: +# name: buildoutput +# path: ${{github.workspace}}/build/ diff --git a/proto-libevdev/ftnoir_protocol_libevdev.cpp b/proto-libevdev/ftnoir_protocol_libevdev.cpp index d357670d..fefcd9bb 100644 --- a/proto-libevdev/ftnoir_protocol_libevdev.cpp +++ b/proto-libevdev/ftnoir_protocol_libevdev.cpp @@ -55,6 +55,11 @@ evdev::evdev() CHECK_LIBEVDEV(libevdev_enable_property(dev, INPUT_PROP_BUTTONPAD)); libevdev_set_name(dev, "opentrack headpose"); + + libevdev_set_id_bustype(dev, 3); + libevdev_set_id_vendor(dev, 4324); + libevdev_set_id_product(dev, 3798); + libevdev_set_id_version(dev, 123); struct input_absinfo absinfo; diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp index 7dff08a7..c55ddf0c 100644 --- a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp +++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp @@ -680,14 +680,20 @@ void NeuralNetTracker::data(double *data) const auto& my = tmp.R.col(1); const auto& mz = tmp.R.col(2); + // For reference: https://en.wikipedia.org/wiki/Euler_angles. Section "Rotation matrix". The relevant matrix is + // under "Tait-Bryan angles", row with "Y_alpha Z_beta X_gamma = ...". + // Because for the NN tracker x is forward, and y is up. We can see that the x axis is independent of roll. Thus it + // is relatively easy to figure out the yaw and pitch angles (alpha and beta). const float yaw = std::atan2(mx(2), mx(0)); const float pitch = -std::atan2(-mx(1), std::sqrt(mx(2)*mx(2)+mx(0)*mx(0))); - const float roll = std::atan2(-my(2), mz(2)); + // For the roll angle we recognize that the matrix entries in the second row contain cos(pitch)*cos(roll), and + // cos(pitch)*sin(roll). Using atan2 eliminates the common pitch factor and we obtain the roll angle. + const float roll = std::atan2(-mz(1), my(1)); { constexpr double rad2deg = 180/M_PI; data[Yaw] = rad2deg * yaw; data[Pitch] = rad2deg * pitch; - data[Roll] = rad2deg * roll; + data[Roll] = -rad2deg * roll; // convert to cm data[TX] = -tmp.t[2] * 0.1; |