Download Prio API Quick Start Guide
Transcript
Once the enumeration process is complete data can be retrieved. Many functions provide a structure or
an array to get the data; prio_getTaredOrientationAsQuaternion writes out a quaternion as an array of
four floats along with an optional time stamp as an unsigned integer.
printf("Get
printf("Get the
the Tared
Tared Orientation
Orientation of
of each
each present
present node.\n");
node.\n");
float
float quat[4];
quat[4];
uint32_t
uint32_t timestamp;
timestamp;
for
for (i
(i == 0;
0; ii << sizeof(present_nodes)
sizeof(present_nodes) // sizeof(uint8_t);
sizeof(uint8_t); i++)
i++)
{{
if
if (present_nodes[i])
(present_nodes[i])
{{
error
error == prio_getTaredOrientationAsQuaternion(prio_device,
prio_getTaredOrientationAsQuaternion(prio_device, i,
i, quat,
quat, ×tamp);
×tamp);
if
(!error)
if (!error)
{{
printf("\t%d
printf("\t%d Quat:
Quat: %f,%f,%f,%f-Timestamp:
%f,%f,%f,%f-Timestamp: %u\n",
%u\n",
i,
i, quat[0],
quat[0], quat[1],
quat[1], quat[2],
quat[2], quat[3],
quat[3], timestamp);
timestamp);
}}
else
else
{{
printf("ERROR:
printf("ERROR: %s\n",
%s\n", prio_error_string[error]);
prio_error_string[error]);
}}
}}
}}
After getting the data needed the example destroys the connection with the Prio device then resets the
API.
prio_destroyDevice(device);
prio_destroyDevice(device);
error
error == prio_resetPrioApi();
prio_resetPrioApi();
if
if (error
(error !=
!= PRIO_NO_ERROR)
PRIO_NO_ERROR)
{{
printf("ERROR:
printf("ERROR: %s\n",
%s\n", prio_error_string[error]);
prio_error_string[error]);
}}
}}
printf("\nFinished
printf("\nFinished press
press Enter
Enter to
to continue");
continue");
getchar();
getchar();
return
return 0;
0;
©2007-2014 YEI Corporation
6/13