vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Poser_Tek4662.C
Go to the documentation of this file.
1 #include <math.h> // for floor
2 #include <stdio.h> // for fprintf, stderr, NULL
3 #include <string.h> // for strlen, memcpy
4 
5 #include "vrpn_BaseClass.h" // for ::vrpn_TEXT_ERROR
6 #include "vrpn_Connection.h" // for vrpn_HANDLERPARAM, etc
7 // Include vrpn_Shared.h _first_ to avoid conflicts with sys/time.h
8 // and unistd.h
9 #include "vrpn_Shared.h" // for timeval, vrpn_unbuffer, etc
10 #include "vrpn_Types.h" // for vrpn_float64, vrpn_uint16
11 
12 #ifdef _WIN32
13 #ifndef _WIN32_WCE
14 #include <io.h>
15 #endif
16 #endif
17 
18 #include "vrpn_Poser_Tek4662.h"
19 
20 //#define VERBOSE
21 
22 const int vrpn_Poser_Tek4662_FAIL = -1;
26 
27 // Plotter motion constants
28 const double COUNTS_PER_METER = 1.0 / ( (15.0 / 4095.0) * ( 0.0254 / 1.0 ) );
29 const double MAX_X = 0.381; // Range of the X axis is 15 inches
30 const double MAX_Y = 0.254; // Range of the Y axis is 10 inches
31 const double VELOCITY= (1/0.06144) * (1/0.00254); // Meters per second
32 
33 // Constants used as characters to communicate to the plotter
34 const unsigned char ESC = 27;
35 const unsigned char BELL = '7';
36 const unsigned char DEVICE = 'A';
37 const unsigned char GS = 29; //< Puts the plotter into graphics mode
38 const unsigned char ZERO = 0;
39 const unsigned char ZEROES[] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
40 const unsigned char PLOTTER_ON[] = { ESC, DEVICE, 'E', ZERO };
41 const unsigned char RESET[] = { ESC, DEVICE, 'N', ZERO };
42 const unsigned char GIN[] = { ESC, DEVICE, 'M' };
43 const unsigned char MOVE_TEMPLATE[] = { GS, 0x20, 0x60, 0x60, 0x20, 0x40 };
44 const int DATA_RECORD_LENGTH = 7;
45 
46 // Constants used to do bit manipulation
47 const unsigned BITFOUR = 1 << 4;
48 const unsigned BITFIVE = 1 << 5;
49 const unsigned LOWFIVEBITS = 0x001f;
50 const unsigned LOWTWOBITS = 0x0003;
51 
53 // Server Code
54 
56  const char *port, int baud, int bits,
57  vrpn_SER_PARITY parity) :
58  vrpn_Poser(name, c),
59  vrpn_Tracker(name, c),
60  d_serial_fd(-1),
61  d_inbufcounter(0),
62  d_new_location_requested(false),
63  d_outstanding_requests(0)
64 {
65  // Make sure that we have a valid connection
66  if (d_connection == NULL) {
67  fprintf(stderr,"vrpn_Poser_Tek4662: No connection\n");
68  return;
69  }
70 
71  // Check the port name;
72  if (port == NULL) {
73  fprintf(stderr,"vrpn_Poser_Tek4662: NULL port name\n");
75  return;
76  }
77 
78  // Open the serial port we're going to use
79  if ( (d_serial_fd=vrpn_open_commport(port, baud, bits, parity)) == -1) {
80  fprintf(stderr,"vrpn_Poser_Tek4662: Cannot Open serial port (%s)\n", port);
82  }
83 
84  // Register a handler for the position change callback for this device
87  fprintf(stderr,"vrpn_Poser_Server: can't register position handler\n");
88  d_connection = NULL;
89  }
90 
91  // Register a handler for the velocity change callback for this device
94  fprintf(stderr,"vrpn_Poser_Server: can't register velocity handler\n");
95  d_connection = NULL;
96  }
97 
98  // Set up the workspace max and min values
99  p_pos_min[0] = 0.0; p_pos_max[0] = MAX_X;
100  p_pos_min[1] = 0.0; p_pos_max[1] = MAX_Y;
101  p_pos_min[2] = 0.0; p_pos_max[2] = 0.0; // There is no Z axis
102  p_vel_min[0] = p_vel_max[0] = VELOCITY; // Meters per second
103  p_vel_min[1] = p_vel_max[1] = VELOCITY; // Meters per second
104  p_vel_min[2] = p_vel_max[2] = 0.0; // No motion in Z
105  p_pos_rot_min[0] = 0.0; p_pos_rot_max[0] = 0.0; // There is no rotation
106  p_pos_rot_min[1] = 0.0; p_pos_rot_max[1] = 0.0; // There is no rotation
107  p_pos_rot_min[2] = 0.0; p_pos_rot_max[2] = 0.0; // There is no rotation
108  p_vel_rot_min[0] = 0.0; p_vel_rot_max[0] = 0.0; // There is no rotation
109  p_vel_rot_min[1] = 0.0; p_vel_rot_max[1] = 0.0; // There is no rotation
110  p_vel_rot_min[2] = 0.0; p_vel_rot_max[2] = 0.0; // There is no rotation
111 
112  // Reset the device and find out what time it is
115 }
116 
117 
119 {
120  // Close com port when destroyed.
121  if (d_serial_fd != -1) {
123  }
124 }
125 
126 // This parses the pen position and location from a GIN report.
127 // It first verifies that the high-order tag bits match what is
128 // expected on all bytes (see page 2-27 of the manual). If they
129 // do not, it returns false; otherwise, true.
130 static bool interpret_GIN_bytes(const unsigned char inbuf[], bool &pen_down, float &x, float &y)
131 {
132  // Check the high-order tag bits to make sure they are valid.
133  for (int i = 0; i < 6; i++) {
134  if ( (inbuf[i] & 0x60) != 0x20) { return false; }
135  }
136  if ( (inbuf[6] & 0x60) != 0x40) { return false; }
137 
138  // Interpret the pen-down bit.
139  pen_down = (inbuf[6] & (1<<2)) != 0;
140 
141  // Unpack the X and Y coordinates from the plotter report as described on
142  // page 2-27 of the manual. Note that in GIN mode, the plotter only uses
143  // the higher-order 12 bits; the lower 4 are set to zero. This means that
144  // we shift three bit past the right and ignore the lowest bit.
145  vrpn_uint16 x_int, y_int;
146  x_int = static_cast<unsigned short>(((inbuf[0] & LOWFIVEBITS) << 7) | ((inbuf[2] & LOWFIVEBITS) << 2) | ((inbuf[4] & LOWFIVEBITS) >> 3));
147  y_int = static_cast<unsigned short>(((inbuf[1] & LOWFIVEBITS) << 7) | ((inbuf[3] & LOWFIVEBITS) << 2) | ((inbuf[5] & LOWFIVEBITS) >> 3));
148 
149  // Convert the position from counts to meters. This goes through inches, which is the native
150  // plotter unit.
151  x = (float)( x_int / COUNTS_PER_METER );
152  y = (float)( y_int / COUNTS_PER_METER );
153 
154 #if 0
155  if (pen_down) { printf("XXX pen down\n"); } else { printf("XXX pen up\n"); }
156  printf("XXX At %f, %f\n", x, y);
157 #endif
158  return true;
159 }
160 
162 {
163  // Wait a little and then flush the input buffer so we don't get extra reports
164  // from before the reset.
165  vrpn_SleepMsecs(100);
167 
168  // Send a bunch of zeroes to clear out the input buffer,
169  // then a "Plotter on", then a "Reset" to the plotter.
173  vrpn_write_characters( d_serial_fd, RESET, strlen((char*)RESET) );
175 
176  // Request a position message from the plotter and then wait
177  // until it responds. Make sure we get a good response. If
178  // so, then send a Tracker message with the specified position
179  // and go into SYNCING mode. If not, then reset again.
180  vrpn_write_characters( d_serial_fd, GIN, strlen((char*)GIN) );
182  unsigned char inbuf[DATA_RECORD_LENGTH];
183  struct timeval wait_time = { 1, 0 };
184  int bufcount = vrpn_read_available_characters( d_serial_fd, inbuf, sizeof(inbuf), &wait_time);
185  if (bufcount != sizeof(inbuf)) {
186  fprintf(stderr,"vrpn_Poser_Tek4662::reset(): Expected %d characters, got %d\n",
187  static_cast<int>(sizeof(inbuf)), bufcount);
188  } else {
189  // Parse the input to find our position and store it in the tracker
190  // position.
191  float x,y;
192  bool pen_down;
193 
195  if (!interpret_GIN_bytes(inbuf, pen_down, x, y)) {
196  send_text_message("vrpn_Poser_Tek4662: Error resetting", timestamp, vrpn_TEXT_ERROR);
197  return;
198  } else {
199  send_text_message("vrpn_Poser_Tek4662: Reset correctly", timestamp, vrpn_TEXT_ERROR);
200  }
201 
202  // Set and send tracker position.
203  pos[0] = x; pos[1] = y; pos[2] = 0;
204  d_quat[0] = d_quat[1] = d_quat[2] = 0; d_quat[3] = 1;
205  if (d_connection) {
206  char msgbuf[1000];
207  int len = vrpn_Tracker::encode_to(msgbuf);
209  position_m_id, d_sender_id, msgbuf,
211  fprintf(stderr,"vrpn_Poser_Tek4662: cannot write message: tossing\n");
212  }
213  } else {
214  fprintf(stderr,"vrpn_Poser_Tek4662: No valid connection\n");
215  }
216 
217  // We're waiting for the first character!
220  }
221 }
222 
224 {
225  struct timeval now;
226 
227  // Send new positions as needed, in coordination with the callback handler.
229 
230  // Figure out the integer location corresponding to the new poser
231  // position requested. We've already tested to make sure that the
232  // position is in bounds.
233  vrpn_uint16 x_int, y_int;
234  x_int = (vrpn_uint16)floor( p_pos[0] * COUNTS_PER_METER );
235  y_int = (vrpn_uint16)floor( p_pos[1] * COUNTS_PER_METER );
236 
237  // Send a command to the plotter to move to the new location.
238  // Request the new location be reported.
239  // The first two characters tell it to go into graph mode; the
240  // last five include the correct upper-two bits for each byte,
241  // with the rest filled in as described on page 2-26 in the manual.
242  unsigned char MOVE[sizeof(MOVE_TEMPLATE)];
243  memcpy(MOVE, MOVE_TEMPLATE, sizeof(MOVE));
244  // Five MSB of y into 5 LSB
245  MOVE[1] |= y_int >> 7;
246  // Two LSB of y into bits 2-3, two LSB of x into bits 0-1
247  MOVE[2] |= (x_int & LOWTWOBITS);
248  MOVE[2] |= (y_int & LOWTWOBITS) << 2;
249  // The rest of the Y bits (five in the middle) to LSB
250  MOVE[3] |= (y_int >> 2) & LOWFIVEBITS;
251  // High-order x bits into low-order bits
252  MOVE[4] |= x_int >> 7;
253  // Intermediate X bits into lower-order bits
254  MOVE[5] |= (x_int >> 2) & LOWFIVEBITS;
255  vrpn_write_characters(d_serial_fd, MOVE, sizeof(MOVE));
256  vrpn_write_characters(d_serial_fd, GIN, strlen((char*)GIN) );
257 
258  // Record the fact that we're moving so that we won't send a new
259  // command until the move completes.
260 #if 0
261  printf("XXX Going to %f,%f (%d, %d)\n", p_pos[0], p_pos[1], x_int, y_int);
262 #endif
264  d_new_location_requested = false;
265  }
266 
267  // Listen for any new reports from the device. Recall that we can get
268  // partial results reported, especially with a 1200-baud or slower serial
269  // connection like we have on this device.
270  // This assumes that the plotter does not tell us where it is until
271  // it finishes moving there. This assumption looks valid from short
272  // tests.
273  if (status == vrpn_Poser_Tek4662_SYNCING) { // Try to get first byte
274  // Zero timeout, poll for any available characters
275  struct timeval timeout = {0, 0};
276  if (1 == vrpn_read_available_characters(d_serial_fd, d_inbuf, 1, &timeout)) {
277  d_inbufcounter = 1; //< Ignore the status byte for the following record
280  } else {
281  d_inbufcounter = 0;
282  }
283  }
285  // Zero timeout, poll for any available characters
286  struct timeval timeout = {0, 0};
289 
290  if (result < 0) {
291  send_text_message("vrpn_Poser_Tek4662: Error reading", timestamp, vrpn_TEXT_ERROR);
293  } else {
294  d_inbufcounter += result;
296  d_inbufcounter = 0;
298 
299  // Parse the input to find our position and store it in the tracker
300  // position.
301  float x,y;
302  bool pen_down;
303 
304  if (!interpret_GIN_bytes(d_inbuf, pen_down, x, y)) {
305  send_text_message("vrpn_Poser_Tek4662: Error parsing position", timestamp, vrpn_TEXT_ERROR);
306  return;
307  }
308 
309  // Set and send tracker position.
310  pos[0] = x; pos[1] = y; pos[2] = 0;
311  d_quat[0] = d_quat[1] = d_quat[2] = 0; d_quat[3] = 1;
312  if (d_connection) {
313  char msgbuf[1000];
314  int len = vrpn_Tracker::encode_to(msgbuf);
316  position_m_id, d_sender_id, msgbuf,
318  fprintf(stderr,"vrpn_Poser_Tek4662: cannot write message: tossing\n");
319  }
320  } else {
321  fprintf(stderr,"vrpn_Poser_Tek4662: No valid connection\n");
322  }
324  }
325  }
326  }
327 
328  // Request the position four times per second when we're outside of
329  // the position command. Remember to increment the number of outstanding
330  // requests so the position-request code keeps working. This will let
331  // the user move the plotter around with the joystick and have the
332  // tracker follow around. It will also keep sending reports so that a
333  // client the connects after reset will know where the plotter is fairly
334  // quickly.
335 
337  vrpn_gettimeofday(&now, NULL);
338  if (vrpn_TimevalDuration(now, timestamp) > 250000L) {
339  // Record the fact that we're asking so that we won't send a new
340  // command until the response completes.
341  vrpn_write_characters(d_serial_fd, GIN, strlen((char*)GIN) );
343  }
344  }
345 
346  // We need a watchdog timer to make sure that the plotter doesn't just
347  // die on us in the middle of a move. If we don't hear from it for 5 seconds,
348  // reset it.
349  vrpn_gettimeofday(&now, NULL);
350  if (vrpn_TimevalDuration(now, timestamp) > 5000000L) {
351  send_text_message("vrpn_Poser_Tek4662: Device timeout (resetting)", now, vrpn_TEXT_ERROR);
353  return;
354  }
355 }
356 
358 {
359  // Call the generic server mainloop routine, since this is a server
360  server_mainloop();
361 
362  // Depending on what mode we're in, do our thing.
363 
364  switch (status) {
366  reset();
367  break;
368 
371  run();
372  break;
373 
375  break;
376 
377  default:
378  fprintf(stderr,"vrpn_Poser_Tek4662: Unknown status (%d)\n", status);
380  break;
381  }
382 }
383 
386 {
388  const char* params = (p.buffer);
389  int i;
390  // Fill in the parameters to the poser from the message
391  if (p.payload_len != (7 * sizeof(vrpn_float64)) ) {
392  fprintf(stderr,"vrpn_Poser_Server: change message payload error\n");
393  fprintf(stderr," (got %d, expected %d)\n",
394  p.payload_len, static_cast<int>(7 * sizeof(vrpn_float64)) );
395  return -1;
396  }
397  me->p_timestamp = p.msg_time;
398 
399  for (i = 0; i < 3; i++) {
400  vrpn_unbuffer(&params, &me->p_pos[i]);
401  }
402  for (i = 0; i < 4; i++) {
403  vrpn_unbuffer(&params, &me->p_quat[i]);
404  }
405 
406  // Check the pose against the max and min values of the workspace
407  for (i = 0; i < 3; i++) {
408  if (me->p_pos[i] < me->p_pos_min[i]) {
409  me->p_pos[i] = me->p_pos_min[i];
410  }
411  else if (me->p_pos[i] > me->p_pos_max[i]) {
412  me->p_pos[i] = me->p_pos_max[i];
413  }
414  }
415 
416  // Set up so that run() will move the plotter to the requested location.
417  me->d_new_location_requested = true;
418 
419  return 0;
420 }
421 
424 {
426  const char* params = (p.buffer);
427  int i;
428 
429  // Fill in the parameters to the poser from the message
430  if (p.payload_len != (8 * sizeof(vrpn_float64)) ) {
431  fprintf(stderr,"vrpn_Poser_Server: velocity message payload error\n");
432  fprintf(stderr," (got %d, expected %d)\n",
433  p.payload_len, static_cast<int>(8 * sizeof(vrpn_float64)) );
434  return -1;
435  }
436  me->p_timestamp = p.msg_time;
437 
438  for (i = 0; i < 3; i++) {
439  vrpn_unbuffer(&params, &me->p_vel[i]);
440  }
441  for (i = 0; i < 4; i++) {
442  vrpn_unbuffer(&params, &me->p_vel_quat[i]);
443  }
444  vrpn_unbuffer(&params, &me->p_vel_quat_dt);
445 
446  // Check the velocity against the max and min values of the workspace
447  for (i = 0; i < 3; i++) {
448  if (me->p_vel[i] < me->p_vel_min[i]) {
449  me->p_vel[i] = me->p_vel_min[i];
450  }
451  else if (me->p_vel[i] > me->p_vel_max[i]) {
452  me->p_vel[i] = me->p_vel_max[i];
453  }
454  }
455 
456  // No response to this message.
457  return 0;
458 }
vrpn_Poser::p_vel_rot_max
vrpn_float64 p_vel_rot_max[3]
Definition: vrpn_Poser.h:47
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
VELOCITY
const double VELOCITY
Definition: vrpn_Poser_Tek4662.C:31
vrpn_Tracker
Definition: vrpn_Tracker.h:49
vrpn_Poser_Tek4662::~vrpn_Poser_Tek4662
virtual ~vrpn_Poser_Tek4662()
Definition: vrpn_Poser_Tek4662.C:118
vrpn_BaseClass.h
ZEROES
const unsigned char ZEROES[]
Definition: vrpn_Poser_Tek4662.C:39
vrpn_TimevalDuration
unsigned long vrpn_TimevalDuration(struct timeval endT, struct timeval startT)
Return number of microseconds between startT and endT.
Definition: vrpn_Shared.C:129
vrpn_Tracker::encode_to
virtual int encode_to(char *buf)
Definition: vrpn_Tracker.C:533
vrpn_Types.h
vrpn_Poser::p_vel_quat
vrpn_float64 p_vel_quat[4]
Definition: vrpn_Poser.h:40
PLOTTER_ON
const unsigned char PLOTTER_ON[]
Definition: vrpn_Poser_Tek4662.C:40
vrpn_drain_output_buffer
int vrpn_drain_output_buffer(int comm)
Wait until all of the characters in the output buffer are sent, then return.
Definition: vrpn_Serial.C:485
vrpn_Poser_Tek4662::d_serial_fd
int d_serial_fd
Definition: vrpn_Poser_Tek4662.h:35
BELL
const unsigned char BELL
Definition: vrpn_Poser_Tek4662.C:35
vrpn_BaseClassUnique::userdata
void * userdata
Definition: vrpn_BaseClass.h:287
vrpn_Tracker::d_quat
vrpn_float64 d_quat[4]
Definition: vrpn_Tracker.h:95
vrpn_Poser_Tek4662::d_inbufcounter
int d_inbufcounter
Definition: vrpn_Poser_Tek4662.h:37
vrpn_Poser_Tek4662::handle_change_message
static int VRPN_CALLBACK handle_change_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_Poser_Tek4662.C:384
vrpn_Tracker::timestamp
struct timeval timestamp
Definition: vrpn_Tracker.h:100
vrpn_HANDLERPARAM::payload_len
vrpn_int32 payload_len
Definition: vrpn_Connection.h:48
COUNTS_PER_METER
const double COUNTS_PER_METER
Definition: vrpn_Poser_Tek4662.C:28
vrpn_Poser::p_vel_min
vrpn_float64 p_vel_min[3]
Definition: vrpn_Poser.h:47
DEVICE
const unsigned char DEVICE
Definition: vrpn_Poser_Tek4662.C:36
vrpn_Poser_Tek4662::d_inbuf
unsigned char d_inbuf[1024]
Definition: vrpn_Poser_Tek4662.h:36
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_SER_PARITY
vrpn_SER_PARITY
Definition: vrpn_Serial.h:15
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_TEXT_ERROR
Definition: vrpn_BaseClass.h:103
vrpn_Poser::p_pos_rot_min
vrpn_float64 p_pos_rot_min[3]
Definition: vrpn_Poser.h:47
vrpn_flush_input_buffer
int vrpn_flush_input_buffer(int comm)
Throw out any characters within the input buffer.
Definition: vrpn_Serial.C:435
ESC
const unsigned char ESC
Definition: vrpn_Poser_Tek4662.C:34
GS
const unsigned char GS
Definition: vrpn_Poser_Tek4662.C:37
vrpn_SleepMsecs
void vrpn_SleepMsecs(double dMsecs)
Definition: vrpn_Shared.C:157
vrpn_HANDLERPARAM
This structure is what is passed to a vrpn_Connection message callback.
Definition: vrpn_Connection.h:44
vrpn_Shared.h
vrpn_Poser_Tek4662::mainloop
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
Definition: vrpn_Poser_Tek4662.C:357
MOVE_TEMPLATE
const unsigned char MOVE_TEMPLATE[]
Definition: vrpn_Poser_Tek4662.C:43
vrpn_Poser
Definition: vrpn_Poser.h:18
vrpn_Poser_Tek4662_RUNNING
const int vrpn_Poser_Tek4662_RUNNING
Definition: vrpn_Poser_Tek4662.C:25
vrpn_BaseClassUnique::d_sender_id
vrpn_int32 d_sender_id
Sender ID registered with the connection.
Definition: vrpn_BaseClass.h:228
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_Poser_Tek4662::vrpn_Poser_Tek4662
vrpn_Poser_Tek4662(const char *name, vrpn_Connection *c, const char *port, int baud=1200, int bits=8, vrpn_SER_PARITY parity=vrpn_SER_PARITY_NONE)
Definition: vrpn_Poser_Tek4662.C:55
vrpn_Poser_Tek4662_SYNCING
const int vrpn_Poser_Tek4662_SYNCING
Definition: vrpn_Poser_Tek4662.C:24
vrpn_HANDLERPARAM::msg_time
struct timeval msg_time
Definition: vrpn_Connection.h:47
RESET
const unsigned char RESET[]
Definition: vrpn_Poser_Tek4662.C:41
vrpn_Tracker::position_m_id
vrpn_int32 position_m_id
Definition: vrpn_Tracker.h:80
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition: vrpn_Connection.h:510
vrpn_Connection.h
vrpn_gettimeofday
#define vrpn_gettimeofday
Definition: vrpn_Shared.h:89
vrpn_Tracker::status
int status
Definition: vrpn_Tracker.h:129
vrpn_Poser_Tek4662::handle_vel_change_message
static int VRPN_CALLBACK handle_vel_change_message(void *userdata, vrpn_HANDLERPARAM p)
Definition: vrpn_Poser_Tek4662.C:422
vrpn_read_available_characters
int vrpn_read_available_characters(int comm, unsigned char *buffer, size_t bytes)
Definition: vrpn_Serial.C:512
vrpn_Poser_Tek4662::run
void run()
Definition: vrpn_Poser_Tek4662.C:223
vrpn_Poser_Tek4662.h
vrpn_Poser::p_vel_rot_min
vrpn_float64 p_vel_rot_min[3]
Definition: vrpn_Poser.h:47
vrpn_close_commport
int vrpn_close_commport(int comm)
Definition: vrpn_Serial.C:345
vrpn_Poser::p_quat
vrpn_float64 p_quat[4]
Definition: vrpn_Poser.h:39
vrpn_Poser_Tek4662
Definition: vrpn_Poser_Tek4662.h:24
ZERO
const unsigned char ZERO
Definition: vrpn_Poser_Tek4662.C:38
BITFIVE
const unsigned BITFIVE
Definition: vrpn_Poser_Tek4662.C:48
vrpn_Poser_Tek4662_RESETTING
const int vrpn_Poser_Tek4662_RESETTING
Definition: vrpn_Poser_Tek4662.C:23
vrpn_Poser_Tek4662::d_new_location_requested
bool d_new_location_requested
Definition: vrpn_Poser_Tek4662.h:40
LOWFIVEBITS
const unsigned LOWFIVEBITS
Definition: vrpn_Poser_Tek4662.C:49
vrpn_Poser::p_pos_min
vrpn_float64 p_pos_min[3]
Definition: vrpn_Poser.h:47
vrpn_write_characters
int vrpn_write_characters(int comm, const unsigned char *buffer, size_t bytes)
Write the buffer to the serial port.
Definition: vrpn_Serial.C:643
vrpn_open_commport
int vrpn_open_commport(const char *portname, long baud, int charsize, vrpn_SER_PARITY parity, bool rts_flow)
Open a serial port, given its name and baud rate.
Definition: vrpn_Serial.C:54
MAX_X
const double MAX_X
Definition: vrpn_Poser_Tek4662.C:29
vrpn_BaseClassUnique::send_text_message
int send_text_message(const char *msg, struct timeval timestamp, vrpn_TEXT_SEVERITY type=vrpn_TEXT_NORMAL, vrpn_uint32 level=0)
Sends a NULL-terminated text message from the device d_sender_id.
Definition: vrpn_BaseClass.C:568
LOWTWOBITS
const unsigned LOWTWOBITS
Definition: vrpn_Poser_Tek4662.C:50
BITFOUR
const unsigned BITFOUR
Definition: vrpn_Poser_Tek4662.C:47
vrpn_Poser::p_vel_quat_dt
vrpn_float64 p_vel_quat_dt
Definition: vrpn_Poser.h:42
vrpn_Poser::p_vel_max
vrpn_float64 p_vel_max[3]
Definition: vrpn_Poser.h:47
vrpn_Tracker::pos
vrpn_float64 pos[3]
Definition: vrpn_Tracker.h:95
vrpn_Poser_Tek4662::reset
void reset(void)
Definition: vrpn_Poser_Tek4662.C:161
vrpn_Poser::req_position_m_id
vrpn_int32 req_position_m_id
Definition: vrpn_Poser.h:33
vrpn_Poser_Tek4662_FAIL
const int vrpn_Poser_Tek4662_FAIL
Definition: vrpn_Poser_Tek4662.C:22
GIN
const unsigned char GIN[]
Definition: vrpn_Poser_Tek4662.C:42
vrpn_flush_output_buffer
int vrpn_flush_output_buffer(int comm)
Throw out any characters (do not send) within the output buffer.
Definition: vrpn_Serial.C:462
MAX_Y
const double MAX_Y
Definition: vrpn_Poser_Tek4662.C:30
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
DATA_RECORD_LENGTH
const int DATA_RECORD_LENGTH
Definition: vrpn_Poser_Tek4662.C:44
vrpn_Poser_Tek4662::d_outstanding_requests
int d_outstanding_requests
Definition: vrpn_Poser_Tek4662.h:41