64 #ifdef VRPN_USE_VIEWPOINT 66 #include VRPN_VIEWPOINT_H 69 vrpn_Tracker_ViewPoint::vrpn_Tracker_ViewPoint(
const char* name,
vrpn_Connection* c,
bool smoothedData) :
73 double version = VPX_GetDLLVersion();
74 if (VPX_VersionMismatch(VPX_SDK_VERSION)) {
75 fprintf(stderr,
"vrpn_Tracker_ViewPoint::vrpn_Tracker_ViewPoint(): Warning, SDK version is %g, while DLL version is %g \n", version, VPX_SDK_VERSION);
78 printf(
"vrpn_Tracker_ViewPoint::vrpn_Tracker_ViewPoint(): SDK version %g matches DLL version %g \n", version, VPX_SDK_VERSION);
85 const int channels_per_eye = 3;
94 vrpn_Tracker_ViewPoint::~vrpn_Tracker_ViewPoint()
98 void vrpn_Tracker_ViewPoint::mainloop()
107 void vrpn_Tracker_ViewPoint::get_report()
110 struct timeval current_time;
123 void vrpn_Tracker_ViewPoint::get_tracker()
126 for (
int i = 0; i < 2; i++) {
133 if (d_sensor == 0) eye = EYE_A;
138 VPX_RealPoint gp, cv, ga;
139 if (useSmoothedData) {
141 VPX_GetGazePointSmoothed2(eye, &gp);
142 VPX_GetComponentVelocity2(eye, &cv);
143 VPX_GetGazeAngleSmoothed2(eye, &ga);
147 VPX_GetGazePoint2(eye, &gp);
148 VPX_GetComponentVelocity2(eye, &cv);
149 VPX_GetGazeAngle2(eye, &ga);
166 q_from_euler(d_quat, 0.0, Q_DEG_TO_RAD(ga.y), Q_DEG_TO_RAD(ga.x));
174 void vrpn_Tracker_ViewPoint::get_analog()
177 for (
int i = 0; i < 2; i++) {
180 if (i == 0) eye = EYE_A;
190 VPX_GetPupilAspectRatio2(eye, &ar);
191 VPX_GetTotalVelocity2(eye, &tv);
192 VPX_GetFixationSeconds2(eye, &fs);
196 channel[0 + eyeOffset] = ar;
197 channel[1 + eyeOffset] = tv;
198 channel[2 + eyeOffset] = fs;
207 void vrpn_Tracker_ViewPoint::send_report()
215 fprintf(stderr,
"vrpn_Tracker_ViewPoint: cannot write message: tossing\n");
220 fprintf(stderr,
"vrpn_Tracker_ViewPoint: cannot write message: tossing\n");
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
Send a report only if something has changed (for servers) Optionally, tell what time to stamp the val...
int register_server_handlers(void)
Generic connection class not specific to the transport mechanism.
virtual int encode_to(char *buf)
#define vrpn_gettimeofday
virtual int encode_vel_to(char *buf)