vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Poser.C
Go to the documentation of this file.
1 #include <quat.h> // for q_mult
2 #include <stdio.h> // for fprintf, stderr, NULL
3 #include <string.h> // for memcpy
4 
5 // NOTE: a vrpn poser must accept poser data (pos and
6 // ori info) which represent the transformation such
7 // that the pos info is the position of the origin of
8 // the poser coord sys in the source coord sys space, and the
9 // quat represents the orientation of the poser relative to the
10 // source space (ie, its value rotates the source's axes so that
11 // they coincide with the poser's)
12 
13 // borrows heavily from the vrpn_Tracker code, as the poser is basically
14 // the inverse of a tracker
15 #include "vrpn_Connection.h" // for vrpn_HANDLERPARAM, etc
16 // Include vrpn_Shared.h _first_ to avoid conflicts with sys/time.h
17 // and unistd.h
18 #include "vrpn_Shared.h" // for timeval, vrpn_buffer, etc
19 
20 #ifdef _WIN32
21 #ifndef _WIN32_WCE
22 #include <io.h>
23 #endif
24 #endif
25 
26 #include "vrpn_Poser.h"
27 
28 //#define VERBOSE
29 // #define READ_HISTOGRAM
30 
32  : vrpn_BaseClass(name, c)
33 {
35 
36  // Find out what time it is and put this into the timestamp
38 
39  // Set the position to the origin and the orientation to identity
40  // just to have something there in case nobody fills them in later
41  p_pos[0] = p_pos[1] = p_pos[2] = 0.0;
42  p_quat[0] = p_quat[1] = p_quat[2] = 0.0;
43  p_quat[3] = 1.0;
44 
45  // Set the velocity to zero and the orientation to identity
46  // just to have something there in case nobody fills them in later
47  p_vel[0] = p_vel[1] = p_vel[2] = 0.0;
48  p_vel_quat[0] = p_vel_quat[1] = p_vel_quat[2] = 0.0;
49  p_vel_quat[3] = 1.0;
50  p_vel_quat_dt = 1;
51 
52  // Set the workspace max and min values just to have something there
53  p_pos_max[0] = p_pos_max[1] = p_pos_max[2] = p_vel_max[0] = p_vel_max[1] =
54  p_vel_max[2] = 1.0;
55  p_pos_min[0] = p_pos_min[1] = p_pos_min[2] = p_vel_min[0] = p_vel_min[1] =
56  p_vel_min[2] = -1.0;
58  p_vel_rot_max[1] = p_vel_rot_max[2] = 1.0;
60  p_vel_rot_min[1] = p_vel_rot_min[2] = -1.0;
61 }
62 
64 {
65  fprintf(stderr, "Pos: %lf, %lf, %lf\n", p_pos[0], p_pos[1], p_pos[2]);
66  fprintf(stderr, "Quat: %lf, %lf, %lf, %lf\n", p_quat[0], p_quat[1],
67  p_quat[2], p_quat[3]);
68 }
69 
71 {
72  fprintf(stderr, "Vel: %lf, %lf, %lf\n", p_vel[0], p_vel[1], p_vel[2]);
73  fprintf(stderr, "Quat: %lf, %lf, %lf, %lf\n", p_vel_quat[0],
74  p_vel_quat[1], p_vel_quat[2], p_vel_quat[3]);
75  fprintf(stderr, "Quat_dt: %lf\n", p_vel_quat_dt);
76 }
77 
79 {
80  // Register this poser device and the needed message types
81  if (d_connection) {
83  d_connection->register_message_type("vrpn_Poser Request Pos_Quat");
85  "vrpn_Poser Request Relative Pos_Quat");
87  d_connection->register_message_type("vrpn_Poser Request Velocity");
89  "vrpn_Poser Request Relative Velocity");
90  }
91  return 0;
92 }
93 
94 // virtual
96 
97 /*
98 int vrpn_Poser::register_server_handlers(void)
99 {
100  if (d_connection){
101 
102 
103  }
104  else {
105  return -1;
106  }
107  return 0;
108 }
109 */
110 
111 // NOTE: you need to be sure that if you are sending vrpn_float64 then
112 // the entire array needs to remain aligned to 8 byte boundaries
113 // (malloced data and static arrays are automatically alloced in
114 // this way). Assumes that there is enough room to store the
115 // entire message. Returns the number of characters sent.
116 int vrpn_Poser::encode_to(char* buf)
117 {
118  char* bufptr = buf;
119  int buflen = 1000;
120 
121  // Message includes: vrpn_float64 p_pos[3], vrpn_float64 p_quat[4]
122  // Byte order of each needs to be reversed to match network standard
123 
124  vrpn_buffer(&bufptr, &buflen, p_pos[0]);
125  vrpn_buffer(&bufptr, &buflen, p_pos[1]);
126  vrpn_buffer(&bufptr, &buflen, p_pos[2]);
127 
128  vrpn_buffer(&bufptr, &buflen, p_quat[0]);
129  vrpn_buffer(&bufptr, &buflen, p_quat[1]);
130  vrpn_buffer(&bufptr, &buflen, p_quat[2]);
131  vrpn_buffer(&bufptr, &buflen, p_quat[3]);
132 
133  return 1000 - buflen;
134 }
135 
137 {
138  char* bufptr = buf;
139  int buflen = 1000;
140 
141  // Message includes: vrpn_float64 p_vel[3], vrpn_float64 p_vel_quat[4],
142  // vrpn_float64 p_vel_quat_dt
143  // Byte order of each needs to be reversed to match network standard
144 
145  vrpn_buffer(&bufptr, &buflen, p_vel[0]);
146  vrpn_buffer(&bufptr, &buflen, p_vel[1]);
147  vrpn_buffer(&bufptr, &buflen, p_vel[2]);
148 
149  vrpn_buffer(&bufptr, &buflen, p_vel_quat[0]);
150  vrpn_buffer(&bufptr, &buflen, p_vel_quat[1]);
151  vrpn_buffer(&bufptr, &buflen, p_vel_quat[2]);
152  vrpn_buffer(&bufptr, &buflen, p_vel_quat[3]);
153 
154  vrpn_buffer(&bufptr, &buflen, p_vel_quat_dt);
155 
156  return 1000 - buflen;
157 }
158 
159 void vrpn_Poser::set_pose(const timeval t, const vrpn_float64 position[3],
160  const vrpn_float64 quaternion[4])
161 {
162  // Update the time
163  p_timestamp.tv_sec = t.tv_sec;
164  p_timestamp.tv_usec = t.tv_usec;
165 
166  // Update the position and quaternion
167  memcpy(p_pos, position, sizeof(p_pos));
168  memcpy(p_quat, quaternion, sizeof(p_quat));
169 }
170 
171 void vrpn_Poser::set_pose_relative(const timeval t,
172  const vrpn_float64 position_delta[3],
173  const vrpn_float64 quaternion[4])
174 {
175  // Update the time
176  p_timestamp.tv_sec = t.tv_sec;
177  p_timestamp.tv_usec = t.tv_usec;
178 
179  // Update the position and quaternion
180  p_pos[0] += position_delta[0];
181  p_pos[1] += position_delta[1];
182  p_pos[2] += position_delta[2];
183  q_mult(p_quat, quaternion, p_quat);
184 }
185 
186 void vrpn_Poser::set_pose_velocity(const timeval t,
187  const vrpn_float64 velocity[3],
188  const vrpn_float64 quaternion[4],
189  const vrpn_float64 interval)
190 {
191  // Update the time
192  p_timestamp.tv_sec = t.tv_sec;
193  p_timestamp.tv_usec = t.tv_usec;
194 
195  // Update the position and quaternion
196  memcpy(p_vel, velocity, sizeof(p_vel));
197  memcpy(p_vel_quat, quaternion, sizeof(p_vel_quat));
198 
199  // Update the interval
200  p_vel_quat_dt = interval;
201 }
202 
204  const timeval t, const vrpn_float64 velocity_delta[3],
205  const vrpn_float64 quaternion[4], const vrpn_float64 interval_delta)
206 {
207  // Update the time
208  p_timestamp.tv_sec = t.tv_sec;
209  p_timestamp.tv_usec = t.tv_usec;
210 
211  // Update the position and quaternion
212  p_vel[0] += velocity_delta[0];
213  p_vel[1] += velocity_delta[1];
214  p_vel[2] += velocity_delta[2];
215  q_mult(p_vel_quat, quaternion, p_vel_quat);
216 
217  // Update the interval
218  p_vel_quat_dt += interval_delta;
219 }
220 
222 // Server Code
223 
225  : vrpn_Poser(name, c)
226 {
227  // register_server_handlers();
228 
229  // Make sure that we have a valid connection
230  if (d_connection == NULL) {
231  fprintf(stderr, "vrpn_Poser_Server: No connection\n");
232  return;
233  }
234 
235  // Register a handler for the position change callback for this device
237  this, d_sender_id)) {
238  fprintf(stderr, "vrpn_Poser_Server: can't register position handler\n");
239  d_connection = NULL;
240  }
241 
242  // Register a handler for the relative position change callback for this
243  // device
246  d_sender_id)) {
247  fprintf(
248  stderr,
249  "vrpn_Poser_Server: can't register relative position handler\n");
250  d_connection = NULL;
251  }
252 
253  // Register a handler for the velocity change callback for this device
256  fprintf(stderr, "vrpn_Poser_Server: can't register velocity handler\n");
257  d_connection = NULL;
258  }
259 
260  // Register a handler for the relative velocity change callback for this
261  // device
264  d_sender_id)) {
265  fprintf(stderr, "vrpn_Poser_Server: can't register velocity handler\n");
266  d_connection = NULL;
267  }
268 }
269 
271 {
272  // Call the generic server mainloop routine, since this is a server
273  server_mainloop();
274 }
275 
278 {
280  const char* params = (p.buffer);
281  int i;
282 
283  vrpn_POSERCB cp;
284  // Fill in the parameters to the poser from the message
285  if (p.payload_len != (7 * sizeof(vrpn_float64))) {
286  fprintf(stderr, "vrpn_Poser_Server: change message payload error\n");
287  fprintf(stderr, " (got %d, expected %lud)\n", p.payload_len,
288  static_cast<unsigned long>(7 * sizeof(vrpn_float64)));
289  return -1;
290  }
291  me->p_timestamp = p.msg_time;
292 
293  for (i = 0; i < 3; i++) {
294  vrpn_unbuffer(&params, &me->p_pos[i]);
295  }
296  for (i = 0; i < 4; i++) {
297  vrpn_unbuffer(&params, &me->p_quat[i]);
298  }
299 
300  // Check the pose against the max and min values of the workspace
301  for (i = 0; i < 3; i++) {
302  if (me->p_pos[i] < me->p_pos_min[i]) {
303  me->p_pos[i] = me->p_pos_min[i];
304  }
305  else if (me->p_pos[i] > me->p_pos_max[i]) {
306  me->p_pos[i] = me->p_pos_max[i];
307  }
308  }
309 
311  cp.msg_time = me->p_timestamp;
312  memcpy(cp.pos, me->p_pos, sizeof(cp.pos));
313  memcpy(cp.quat, me->p_quat, sizeof(cp.quat));
314  // Go down the list of callbacks that have been registered.
315  // Fill in the parameter and call each.
317 
318  return 0;
319 }
320 
323 {
325  const char* params = (p.buffer);
326  int i;
327 
328  // Fill in the parameters to the poser from the message
329  if (p.payload_len != (7 * sizeof(vrpn_float64))) {
330  fprintf(stderr, "vrpn_Poser_Server: change message payload error\n");
331  fprintf(stderr, " (got %d, expected %lud)\n", p.payload_len,
332  static_cast<unsigned long>(7 * sizeof(vrpn_float64)));
333  return -1;
334  }
335  me->p_timestamp = p.msg_time;
336 
337  vrpn_float64 dp[3], dq[4];
338  for (i = 0; i < 3; i++) {
339  vrpn_unbuffer(&params, &(dp[i]));
340  }
341  for (i = 0; i < 4; i++) {
342  vrpn_unbuffer(&params, &(dq[i]));
343  }
344 
345  // apply the requested changes
346  for (i = 0; i <= 2; i++)
347  me->p_pos[i] += dp[i];
348  q_mult(me->p_quat, dq, me->p_quat);
349 
350  // Check the pose against the max and min values of the workspace
351  for (i = 0; i < 3; i++) {
352  if (me->p_pos[i] < me->p_pos_min[i]) {
353  me->p_pos[i] = me->p_pos_min[i];
354  }
355  else if (me->p_pos[i] > me->p_pos_max[i]) {
356  me->p_pos[i] = me->p_pos_max[i];
357  }
358  }
359 
361  vrpn_POSERCB cp;
362  cp.msg_time = me->p_timestamp;
363  memcpy(cp.pos, dp, sizeof(cp.pos));
364  memcpy(cp.quat, dq, sizeof(cp.quat));
365  // Go down the list of callbacks that have been registered.
367 
368  return 0;
369 }
370 
373 {
375  const char* params = (p.buffer);
376  int i;
377 
378  // Fill in the parameters to the poser from the message
379  if (p.payload_len != (8 * sizeof(vrpn_float64))) {
380  fprintf(stderr, "vrpn_Poser_Server: velocity message payload error\n");
381  fprintf(stderr, " (got %d, expected %lud)\n", p.payload_len,
382  static_cast<unsigned long>(8 * sizeof(vrpn_float64)));
383  return -1;
384  }
385  me->p_timestamp = p.msg_time;
386 
387  for (i = 0; i < 3; i++) {
388  vrpn_unbuffer(&params, &me->p_vel[i]);
389  }
390  for (i = 0; i < 4; i++) {
391  vrpn_unbuffer(&params, &me->p_vel_quat[i]);
392  }
393  vrpn_unbuffer(&params, &me->p_vel_quat_dt);
394 
395  // Check the velocity against the max and min values of the workspace
396  for (i = 0; i < 3; i++) {
397  if (me->p_vel[i] < me->p_vel_min[i]) {
398  me->p_vel[i] = me->p_vel_min[i];
399  }
400  else if (me->p_vel[i] > me->p_vel_max[i]) {
401  me->p_vel[i] = me->p_vel_max[i];
402  }
403  }
404  return 0;
405 }
406 
409 {
411  const char* params = (p.buffer);
412  int i;
413 
414  // Fill in the parameters to the poser from the message
415  if (p.payload_len != (8 * sizeof(vrpn_float64))) {
416  fprintf(stderr, "vrpn_Poser_Server: velocity message payload error\n");
417  fprintf(stderr, " (got %d, expected %lud)\n", p.payload_len,
418  static_cast<unsigned long>(8 * sizeof(vrpn_float64)));
419  return -1;
420  }
421  me->p_timestamp = p.msg_time;
422 
423  vrpn_float64 dv[3], dq[4], di;
424  for (i = 0; i < 3; i++) {
425  vrpn_unbuffer(&params, &(dv[i]));
426  }
427  for (i = 0; i < 4; i++) {
428  vrpn_unbuffer(&params, &(dq[i]));
429  }
430  vrpn_unbuffer(&params, &di);
431 
432  // apply the requested changes
433  for (i = 0; i < 2; i++)
434  me->p_vel[i] += dv[i];
435  q_mult(me->p_quat, dq, me->p_quat);
436  me->p_vel_quat_dt += di;
437 
438  // Check the velocity against the max and min values of the workspace
439  for (i = 0; i < 3; i++) {
440  if (me->p_vel[i] < me->p_vel_min[i]) {
441  me->p_vel[i] = me->p_vel_min[i];
442  }
443  else if (me->p_vel[i] > me->p_vel_max[i]) {
444  me->p_vel[i] = me->p_vel_max[i];
445  }
446  }
447  return 0;
448 }
449 
451 // Client Code
452 // Note that the Remote class uses p_pos and p_quat for the absolute
453 // position/orientation as well as position/orientation deltas when
454 // requesting relative changes. Externally, these are write-only variables,
455 // so no user code will need to change. If these are ever made readable
456 // from the Remote class, additional data members will need to be added
457 // to hold the delta values, as well as addition methods for encoding.
458 
460  : vrpn_Poser(name, c)
461 {
462  // Make sure that we have a valid connection
463  if (d_connection == NULL) {
464  fprintf(stderr, "vrpn_Poser_Remote: No connection\n");
465  return;
466  }
467 }
468 
469 // The remote poser has to un-register its handlers when it
470 // is destroyed to avoid seg faults (this is taken care of by
471 // using autodeleted handlers above). It should also remove all
472 // remaining user-registered callbacks to free up memory.
473 
475 {
476  // Delete all of the callback handlers that other code had registered
477  // with this object. This will free up the memory taken by the lists
478 }
479 
481 {
482  if (d_connection) {
484  }
485  client_mainloop();
486 }
487 
488 int vrpn_Poser_Remote::request_pose(const struct timeval t,
489  const vrpn_float64 position[3],
490  const vrpn_float64 quaternion[4])
491 {
492  // Set the requested pose
493  set_pose(t, position, quaternion);
494 
495  // Send position request
496  if (client_send_pose() != 0) {
497  fprintf(stderr, "vrpn_Poser_Remote: request_pose failed\n");
498  return 0;
499  }
500 
501  return 1;
502 }
503 
505  const struct timeval t, const vrpn_float64 position_delta[3],
506  const vrpn_float64 quaternion[4])
507 {
508  // Set the requested pose
509  set_pose_relative(t, position_delta, quaternion);
510 
511  // Send position request
512  if (client_send_pose_relative() != 0) {
513  fprintf(stderr, "vrpn_Poser_Remote: request_pose_relative failed\n");
514  return 0;
515  }
516 
517  return 1;
518 }
519 
520 int vrpn_Poser_Remote::request_pose_velocity(const struct timeval t,
521  const vrpn_float64 velocity[3],
522  const vrpn_float64 quaternion[4],
523  const vrpn_float64 interval)
524 {
525  // Set the requested velocity
526  set_pose_velocity(t, velocity, quaternion, interval);
527 
528  // Send position request
529  if (client_send_pose_velocity() != 0) {
530  fprintf(stderr, "vrpn_Poser_Remote: request_pose_velocity failed\n");
531  return 0;
532  }
533 
534  return 1;
535 }
536 
538  const struct timeval t, const vrpn_float64 velocity_delta[3],
539  const vrpn_float64 quaternion[4], const vrpn_float64 interval_delta)
540 {
541  // Set the requested velocity
542  set_pose_velocity(t, velocity_delta, quaternion, interval_delta);
543 
544  // Send position request
546  fprintf(stderr,
547  "vrpn_Poser_Remote: request_pose_velocity_relative failed\n");
548  return 0;
549  }
550 
551  return 1;
552 }
553 
555 {
556  char msgbuf[1000];
557  vrpn_int32 len;
558 
559  // Pack pose
560  len = encode_to(msgbuf);
562  d_sender_id, msgbuf,
564  fprintf(stderr, "vrpn_Poser_Remote: can't write a message: tossing\n");
565  return -1;
566  }
567 
568  return 0;
569 }
570 
572 {
573  char msgbuf[1000];
574  vrpn_int32 len;
575 
576  // Pack pose delta.
577  len = encode_to(msgbuf);
579  d_sender_id, msgbuf,
581  fprintf(stderr, "vrpn_Poser_Remote: can't write a message: tossing\n");
582  return -1;
583  }
584 
585  return 0;
586 }
587 
589 {
590  char msgbuf[1000];
591  vrpn_int32 len;
592 
593  // Pack velocity
594  len = encode_vel_to(msgbuf);
596  d_sender_id, msgbuf,
598  fprintf(stderr, "vrpn_Poser_Remote: can't write a message: tossing\n");
599  return -1;
600  }
601 
602  return 0;
603 }
604 
606 {
607  char msgbuf[1000];
608  vrpn_int32 len;
609 
610  // Pack velocity delta
611  len = encode_vel_to(msgbuf);
613  d_sender_id, msgbuf,
615  fprintf(stderr, "vrpn_Poser_Remote: can't write a message: tossing\n");
616  return -1;
617  }
618 
619  return 0;
620 }
vrpn_Poser_Remote::vrpn_Poser_Remote
vrpn_Poser_Remote(const char *name, vrpn_Connection *c=NULL)
Definition: vrpn_Poser.C:459
vrpn_Poser::p_vel_rot_max
vrpn_float64 p_vel_rot_max[3]
Definition: vrpn_Poser.h:47
vrpn_Poser::encode_to
virtual int encode_to(char *buf)
Definition: vrpn_Poser.C:116
vrpn_BaseClassUnique::register_autodeleted_handler
int register_autodeleted_handler(vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void *userdata, vrpn_int32 sender=vrpn_ANY_SENDER)
Registers a handler with the connection, and remembers to delete at destruction.
Definition: vrpn_BaseClass.C:503
vrpn_Connection::pack_message
virtual int pack_message(vrpn_uint32 len, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer, vrpn_uint32 class_of_service)
Pack a message that will be sent the next time mainloop() is called. Turn off the RELIABLE flag if yo...
Definition: vrpn_Connection.C:4632
vrpn_BaseClassUnique::client_mainloop
void client_mainloop(void)
Handles functions that all clients should provide in their mainloop() (warning of no server,...
Definition: vrpn_BaseClass.C:637
vrpn_Poser_Server::d_relative_callback_list
vrpn_Callback_List< vrpn_POSERCB > d_relative_callback_list
Definition: vrpn_Poser.h:139
vrpn_Poser_Remote::client_send_pose
virtual int client_send_pose()
Definition: vrpn_Poser.C:554
vrpn_Poser::set_pose_velocity_relative
virtual void set_pose_velocity_relative(const struct timeval t, const vrpn_float64 velocity_delta[3], const vrpn_float64 quaternion[4], const vrpn_float64 interval_delta)
Definition: vrpn_Poser.C:203
vrpn_Poser_Server::handle_change_message
static int VRPN_CALLBACK handle_change_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_Poser.C:276
vrpn_Poser_Server::mainloop
virtual void mainloop()
This function should be called each time through app mainloop.
Definition: vrpn_Poser.C:270
vrpn_Poser::p_vel_quat
vrpn_float64 p_vel_quat[4]
Definition: vrpn_Poser.h:40
vrpn_Poser_Remote::request_pose
int request_pose(const struct timeval t, const vrpn_float64 position[3], const vrpn_float64 quaternion[4])
Definition: vrpn_Poser.C:488
vrpn_BaseClassUnique::userdata
void * userdata
Definition: vrpn_BaseClass.h:287
vrpn_Poser_Server::handle_relative_change_message
static int VRPN_CALLBACK handle_relative_change_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_Poser.C:321
vrpn_HANDLERPARAM::payload_len
vrpn_int32 payload_len
Definition: vrpn_Connection.h:48
vrpn_Poser::p_vel_min
vrpn_float64 p_vel_min[3]
Definition: vrpn_Poser.h:47
vrpn_Poser::set_pose_velocity
virtual void set_pose_velocity(const struct timeval t, const vrpn_float64 position[3], const vrpn_float64 quaternion[4], const vrpn_float64 interval)
Definition: vrpn_Poser.C:186
vrpn_Poser::vrpn_Poser
vrpn_Poser(const char *name, vrpn_Connection *c=NULL)
Definition: vrpn_Poser.C:31
vrpn_Poser_Server::handle_vel_change_message
static int VRPN_CALLBACK handle_vel_change_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_Poser.C:371
vrpn_POSERCB::quat
vrpn_float64 quat[4]
Definition: vrpn_Poser.h:89
vrpn_Poser::set_pose_relative
virtual void set_pose_relative(const struct timeval t, const vrpn_float64 position_delta[3], const vrpn_float64 quaternion[4])
Definition: vrpn_Poser.C:171
vrpn_Poser::register_types
virtual int register_types(void)
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.
Definition: vrpn_Poser.C:78
vrpn_CONNECTION_LOW_LATENCY
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
Definition: vrpn_Connection.h:122
vrpn_unbuffer
VRPN_API int vrpn_unbuffer(const char **buffer, timeval *t)
Utility routine for taking a struct timeval from a buffer that was sent as a message.
Definition: vrpn_Shared.C:312
vrpn_Poser::p_pos_rot_max
vrpn_float64 p_pos_rot_max[3]
Definition: vrpn_Poser.h:47
vrpn_Poser::req_velocity_m_id
vrpn_int32 req_velocity_m_id
Definition: vrpn_Poser.h:35
vrpn_BaseClassUnique::d_connection
vrpn_Connection * d_connection
Connection that this object talks to.
Definition: vrpn_BaseClass.h:224
vrpn_HANDLERPARAM::buffer
const char * buffer
Definition: vrpn_Connection.h:49
vrpn_Connection::register_message_type
virtual vrpn_int32 register_message_type(const char *name)
Definition: vrpn_Connection.C:5074
vrpn_Poser::p_pos_rot_min
vrpn_float64 p_pos_rot_min[3]
Definition: vrpn_Poser.h:47
vrpn_HANDLERPARAM
This structure is what is passed to a vrpn_Connection message callback.
Definition: vrpn_Connection.h:44
vrpn_Shared.h
vrpn_Poser
Definition: vrpn_Poser.h:18
vrpn_POSERCB::pos
vrpn_float64 pos[3]
NOTE: I think since we have different routines for handling velocity and position poser requests,...
Definition: vrpn_Poser.h:88
vrpn_BaseClassUnique::d_sender_id
vrpn_int32 d_sender_id
Sender ID registered with the connection.
Definition: vrpn_BaseClass.h:228
vrpn_Poser::req_velocity_relative_m_id
vrpn_int32 req_velocity_relative_m_id
Definition: vrpn_Poser.h:36
vrpn_Poser_Remote::~vrpn_Poser_Remote
virtual ~vrpn_Poser_Remote(void)
Definition: vrpn_Poser.C:474
vrpn_Poser_Server
Definition: vrpn_Poser.h:102
vrpn_Poser::p_vel
vrpn_float64 p_vel[3]
Definition: vrpn_Poser.h:40
vrpn_Poser::p_pos
vrpn_float64 p_pos[3]
Definition: vrpn_Poser.h:39
vrpn_Poser::p_pos_max
vrpn_float64 p_pos_max[3]
Definition: vrpn_Poser.h:47
vrpn_Connection::mainloop
virtual int mainloop(const struct timeval *timeout=NULL)=0
Call each time through program main loop to handle receiving any incoming messages and sending any pa...
vrpn_HANDLERPARAM::msg_time
struct timeval msg_time
Definition: vrpn_Connection.h:47
vrpn_Poser_Remote::mainloop
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
Definition: vrpn_Poser.C:480
vrpn_Poser_Server::d_callback_list
vrpn_Callback_List< vrpn_POSERCB > d_callback_list
Definition: vrpn_Poser.h:138
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition: vrpn_Connection.h:510
vrpn_Connection.h
vrpn_Poser_Remote::request_pose_velocity_relative
int request_pose_velocity_relative(const struct timeval t, const vrpn_float64 velocity_delta[3], const vrpn_float64 quaternion[4], const vrpn_float64 interval_delta)
Definition: vrpn_Poser.C:537
vrpn_Poser_Remote::client_send_pose_velocity
virtual int client_send_pose_velocity()
Definition: vrpn_Poser.C:588
vrpn_Poser_Remote::request_pose_relative
int request_pose_relative(const struct timeval t, const vrpn_float64 position_delta[3], const vrpn_float64 quaternion[4])
Definition: vrpn_Poser.C:504
vrpn_gettimeofday
#define vrpn_gettimeofday
Definition: vrpn_Shared.h:89
vrpn_Poser::set_pose
virtual void set_pose(const struct timeval t, const vrpn_float64 position[3], const vrpn_float64 quaternion[4])
Definition: vrpn_Poser.C:159
vrpn_Poser::p_print_vel
void p_print_vel()
Definition: vrpn_Poser.C:70
vrpn_Poser::p_vel_rot_min
vrpn_float64 p_vel_rot_min[3]
Definition: vrpn_Poser.h:47
vrpn_Poser::req_position_relative_m_id
vrpn_int32 req_position_relative_m_id
Definition: vrpn_Poser.h:34
vrpn_Poser::p_quat
vrpn_float64 p_quat[4]
Definition: vrpn_Poser.h:39
vrpn_Poser_Remote::client_send_pose_velocity_relative
virtual int client_send_pose_velocity_relative()
Definition: vrpn_Poser.C:605
vrpn_Poser::p_print
void p_print()
Definition: vrpn_Poser.C:63
vrpn_Poser::encode_vel_to
virtual int encode_vel_to(char *buf)
Definition: vrpn_Poser.C:136
vrpn_Poser_Server::vrpn_Poser_Server
vrpn_Poser_Server(const char *name, vrpn_Connection *c)
Definition: vrpn_Poser.C:224
vrpn_Poser::~vrpn_Poser
virtual ~vrpn_Poser(void)
Definition: vrpn_Poser.C:95
vrpn_Poser.h
vrpn_POSERCB
A structure for Call-Backs related to Vrpn Poser Server.
Definition: vrpn_Poser.h:81
vrpn_BaseClass::init
virtual int init(void)
Initialize things that the constructor can't. Returns 0 on success, -1 on failure.
Definition: vrpn_BaseClass.C:363
vrpn_Poser::p_pos_min
vrpn_float64 p_pos_min[3]
Definition: vrpn_Poser.h:47
vrpn_buffer
VRPN_API int vrpn_buffer(char **insertPt, vrpn_int32 *buflen, const timeval t)
Utility routine for placing a timeval struct into a buffer that is to be sent as a message.
Definition: vrpn_Shared.C:241
vrpn_Poser::p_vel_quat_dt
vrpn_float64 p_vel_quat_dt
Definition: vrpn_Poser.h:42
vrpn_Callback_List::call_handlers
void call_handlers(const CALLBACK_STRUCT &info)
This will pass the referenced parameter as a const to all the callbacks.
Definition: vrpn_BaseClass.h:451
vrpn_Poser::p_vel_max
vrpn_float64 p_vel_max[3]
Definition: vrpn_Poser.h:47
vrpn_Poser_Server::handle_relative_vel_change_message
static int VRPN_CALLBACK handle_relative_vel_change_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_Poser.C:407
vrpn_Poser_Remote::client_send_pose_relative
virtual int client_send_pose_relative()
Definition: vrpn_Poser.C:571
vrpn_Poser::req_position_m_id
vrpn_int32 req_position_m_id
Definition: vrpn_Poser.h:33
vrpn_POSERCB::msg_time
struct timeval msg_time
Definition: vrpn_Poser.h:82
vrpn_Poser_Remote::request_pose_velocity
int request_pose_velocity(const struct timeval t, const vrpn_float64 velocity[3], const vrpn_float64 quaternion[4], const vrpn_float64 interval)
Definition: vrpn_Poser.C:520
vrpn_BaseClassUnique::server_mainloop
void server_mainloop(void)
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should...
Definition: vrpn_BaseClass.C:603
vrpn_Poser::p_timestamp
struct timeval p_timestamp
Definition: vrpn_Poser.h:43
vrpn_BaseClass
Class from which all user-level (and other) classes that communicate with vrpn_Connections should der...
Definition: vrpn_BaseClass.h:313