Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "IFVRHeadset.h"
- #include "FoveTypes.h"
- #include <thread>
- #include <iostream>
- int main(int argc, char* argv)
- {
- Fove::IFVRHeadset* headsetReference = Fove::GetFVRHeadset();
- headsetReference->Initialise(Fove::EFVR_ClientCapabilities::Gaze);
- if (headsetReference->CheckSoftwareVersions() != Fove::EFVR_ErrorCode::None)
- {
- // version mismatch
- std::cout << "Wrong version of software" << std::endl;
- }
- while (!headsetReference->IsHardwareReady()) // wait for hardware to be ready
- {
- std::cout << "Please connect your FOVE" << std::endl;
- std::this_thread::sleep_for(std::chrono::milliseconds(1000));
- }
- std::cout << "Please wait for eye tracking to become available..." << std::endl;
- while (!headsetReference->IsEyeTrackingReady()) // wait for eye tracking to be ready
- {
- std::this_thread::sleep_for(std::chrono::milliseconds(1000));
- }
- if (!headsetReference->IsEyeTrackingCalibrated())
- {
- std::cout << "Not calibrated" << std::endl;
- if (headsetReference->EnsureEyeTrackingCalibration() == Fove::EFVR_ErrorCode::None)
- {
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- while (!headsetReference->IsEyeTrackingCalibrated())
- {
- // waiting for calibration to complete
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- }
- }
- }
- int i = 0;
- while (i < 100) // arbitrary end condition
- {
- // Get gaze data
- Fove::SFVR_GazeVector gv = headsetReference->GetGazeVector(Fove::EFVR_Eye::Left);
- if (gv.error == Fove::EFVR_ErrorCode::None)
- {
- std::cout << gv.timestamp << " - Left Eye X: " << gv.vector.x << ", Y: " << gv.vector.y << std::endl;
- std::this_thread::sleep_for(std::chrono::milliseconds(8));
- i++;
- }
- else
- {
- std::cout << "Error getting gaze vector: " << (int)gv.error << std::endl;
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- }
- }
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement