Simulated Reality SDK 7500c78d v1.30.2.51085 2024-04-26T11:23:03Z
Stable
|
The HeadPoseTracker API works similarly to the EyeTracker API, but exposes the user's head position and orientation rather than the user's eye positions.
The HeadPoseTracker API consists out of the following classes
SRContext
is an essential element of any SR application, it maintains a list of all SR components that are in use and cleans them up when the application ends. It also allows different components of the application to share the same Sense implementations.Sense
is an interface used by the SRContext
to keep track of any input or output devices.HeadPoseTracker
is an interface providing access to head pose data.HeadPoseStream
connects HeadPoseTracker
implementations with user defined HeadPoseListener
implementations.HeadPoseListener
is an interface to be implemented by any components of the user's application that want to receive head pose data.SR_headPose
contains the output data.The SR_headPose
struct is at the center of the HeadPoseTracker interface, this is what applications can subscribe to.
The SR_headPose
struct contains the head position and orientation. For more insight to what these vectors mean, take a look at the coordinate system documentation.
Application developers should define how to handle the head pose data by implementing an HeadPoseListener
. It is advisable to include an InputStream<SR::HeadPoseStream>
member, this will come into play when the actual head pose tracker is constructed.
To get access to head pose data, users will have to construct an SRContext and call the static factory function HeadPoseTracker::create
as follows:
Then we need to construct a listener that follows the desired way of processing the data. By calling set
on the InputStream<SR::HeadPoseStream>
field we ensure that the stream is destructed correctly when the HeadPoseListenerImplementation
goes out of scope. When everything is set up context.initialize()
starts using any newly constructed streams to listeners.
If the main function of our application returns, all deconstructors will be called and we will no longer receive data. We should ensure that the application remains open as long as we want.