-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExampleMain.cpp
More file actions
32 lines (27 loc) · 939 Bytes
/
Copy pathExampleMain.cpp
File metadata and controls
32 lines (27 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include "easyvxr.h"
#include <unistd.h>
int main(void)
{
//Initalize the XR glasses (they must be already connected to the computer via USB):
if (!easyvxr_start_and_connect())
{
std::cout<<"Failed to connect the glasses. Exiting...\n";
return -1;
}
std::cout<<"Glasses connected successfully.\n";
int iterations = 0; //Will be used to break from the loop after some time.
//Main loop:
while (iterations<5)
{
//Do things here, like getting latest IMU data:
easyvxrImuData imuData = easyvxr_get_latest_imu_data();
std::cout << "Roll: " << imuData.eulerRoll << ", Pitch: " << imuData.eulerPitch << ", Yaw: " << imuData.eulerYaw << std::endl;
sleep(1); //A small delay
iterations+=1;
}
//Disconnect the XR glasses:
easyvxr_end_disconnect();
std::cout<<"Program finished fully.\n";
return 0;
}