15 #include <visiontransfer/deviceenumeration.h> 23 #include <visiontransfer/datachannelservice.h> 27 #define usleep(X) Sleep(X/1000) 35 int main(
int argc,
const char** argv) {
41 if(devices.size() == 0) {
42 std::cout <<
"No devices discovered!" << std::endl;
47 std::cout <<
"Discovered devices:" << std::endl;
48 for(
unsigned int i = 0; i< devices.size(); i++) {
49 std::cout << devices[i].toString() << std::endl;
51 std::cout << std::endl;
53 std::cout <<
"Connecting to " << devices[0].toString() << std::endl;
60 std::cout << std::endl <<
"Device reports " << (service.imuAvailable()?
"an inertial measurement unit.":
"inertial measurement unit is not available.") << std::endl << std::endl;
62 if (!service.imuAvailable()) {
66 std::vector<TimestampedQuaternion> quaternionBufferData;
67 std::vector<TimestampedVector> vectorBufferData;
72 quaternionBufferData = service.imuGetRotationQuaternionSeries();
73 vectorBufferData = service.imuGetLinearAccelerationSeries();
76 double roll, pitch, yaw;
83 std::cout << std::setprecision(2) << std::fixed;
84 std::cout <<
"Device orientation: " << quat.x() <<
" " << quat.y() <<
" " << quat.z() <<
" " << quat.w() <<
" accuracy " << quat.
accuracy() << std::endl;
85 std::cout <<
" -> Roll " << roll <<
" Pitch " << pitch <<
" Yaw " << yaw << std::endl;
86 std::cout <<
" and read orientation time series of size " << quaternionBufferData.size() << std::endl;
87 std::cout <<
"Linear acceleration: " << lin.x() <<
" " << lin.y() <<
" " << lin.z() << std::endl;
88 std::cout <<
" and read linear accel time series of size " << vectorBufferData.size() << std::endl;
89 std::cout << std::endl;
93 }
catch(
const std::exception& ex) {
94 std::cerr <<
"Exception occurred: " << ex.what() << std::endl;
void getRollPitchYaw(double &roll, double &pitch, double &yaw)
Encapsulate a 4D (quaternion) sensor report, containing X, Y, Z, W, as well as timestamp and status f...
DeviceList discoverDevices()
Discovers new devices and returns the list of all devices that have been found.
Encapsulate a 3D sensor report, containing X, Y, Z, as well as timestamp and status fields...
Allows for the discovery of devices in the network.