vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Tracker_NDI_Polaris.C
Go to the documentation of this file.
1 
2 #include <stdio.h> // for fprintf, printf, sprintf, etc
3 #include <string.h> // for strncmp, strlen, strncpy
4 
5 #include "vrpn_Connection.h" // for vrpn_CONNECTION_LOW_LATENCY, etc
6 #include "vrpn_Serial.h" // for vrpn_close_commport, etc
7 #include "vrpn_Shared.h" // for vrpn_SleepMsecs, etc
8 #include "vrpn_Tracker.h" // for vrpn_Tracker
10 #include "vrpn_Types.h" // for vrpn_float64
11 
13  vrpn_Connection *c,
14  const char *port,
15  int numOfRigidBodies,
16  const char** rigidBodyNDIRomFileNames) : vrpn_Tracker(name,c)
17 {
18  latestResponseStr=new unsigned char[MAX_NDI_RESPONSE_LENGTH];
19 
21  //STEP 1: open com port at NDI's default speed
23 
24 
25  serialFd=vrpn_open_commport(port,9600);
26  if (serialFd==-1){
27  fprintf(stderr,"vrpn_Tracker_NDI_Polaris: Can't open serial port: %s\n",port);
28  } else {
29 
30  printf("connected to NDI Polaris at default 9600 baud on device:%s.\n",port);
31 
32  //send a reset
33 #ifdef DEBUG
34  printf("DEBUG: Reseting com port");
35 #endif
37  vrpn_SleepMsecs(100);
39  printf("done\n");
40 
41  vrpn_SleepMsecs(100); //if the NDI was previously running at the higher rate, it will need some time to reset
42  vrpn_flush_input_buffer(serialFd); //get rid of any reset message the NDI might have sent
43 
45  //STEP 2: switch to a higher baud rate
48 
50  //STEP 3: INIT tracker
52 
53 
54  sendCommand("INIT ");
55  readResponse();
56 #ifdef DEBUG
57  printf("DEBUG:Init response: >%s<\n",latestResponseStr);
58 #endif
59 
60  //0 = 20hz(default), 1= 30Hz, 2=60Hz
61  sendCommand("IRATE 0"); //set the illumination to the default
62  readResponse();
63 #ifdef DEBUG
64  printf("DEBUG: IRATE response: >%s<\n",latestResponseStr);
65 #endif
66 
67 
69  //STEP 4: SETUP EACH TOOL (i.e. rigid body)
71 
72  this->numOfRigidBodies=numOfRigidBodies;
73 
74  //declare an array of filenames, one for each tool
75  for (int t=0; t<numOfRigidBodies; t++) {
76  if (setupOneTool(rigidBodyNDIRomFileNames[t])<1) {
77  fprintf(stderr,"vrpn_Tracker_NDI_Polaris: tool %s didn't init properly!\n",rigidBodyNDIRomFileNames[t]);
78  }
79  }
80 
82  //STEP 5: GO TO TRACKING MODE
84 
85  sendCommand("TSTART 80"); //80 resets the frame counter to zero
86  readResponse();
87 #ifdef DEBUG
88  printf("DEBUG: Tstart response: >%s<\n",latestResponseStr);
89 #endif
90  }
91 
92 }
93 
95 {
97 }
98 
100 {
101  get_report();
102 
103  // Call the generic server mainloop, since we are a server
104  server_mainloop();
105 
106  return;
107 }
108 
110 // returns 0 on fail
111 {
113 
114  sendCommand("TX ");
115  readResponse();
116  //printf("DEBUG: TX response: >%s %i<\n",latestResponseStr);
117 
118  //int numOfHandles=parse2CharIntFromNDIResponse(latestResponseStr);
119  int TXResponseStrIndex=2;
120  bool gotAtLeastOneReport=false;
121 
122  for (int t=0; t<numOfRigidBodies; t++) {
123  //int handleNum=parse2CharIntFromNDIResponse(latestResponseStr,&TXResponseStrIndex);
124  // check if the tool is present. Parse and print out the transform data if and only if
125  // it's not missing
126  if (strncmp("MISSING",(char *) &latestResponseStr[TXResponseStrIndex],7)!=0) {
127  gotAtLeastOneReport=true;
128  d_sensor = t;
129 
130  // NDI gives qw first(qw,qx,qy,qz), whereas VRPN wants it last (qx,qy,qz,qw)
131  d_quat[3]=parse6CharFloatFromNDIResponse(latestResponseStr,&TXResponseStrIndex); //qw
132  d_quat[0]=parse6CharFloatFromNDIResponse(latestResponseStr,&TXResponseStrIndex); //qx
133  d_quat[1]=parse6CharFloatFromNDIResponse(latestResponseStr,&TXResponseStrIndex); //qy
134  d_quat[2]=parse6CharFloatFromNDIResponse(latestResponseStr,&TXResponseStrIndex); //qz
135 
136  pos[0]=parse7CharFloatFromNDIResponse(latestResponseStr,&TXResponseStrIndex);
137  pos[1]=parse7CharFloatFromNDIResponse(latestResponseStr,&TXResponseStrIndex);
138  pos[2]=parse7CharFloatFromNDIResponse(latestResponseStr,&TXResponseStrIndex);
139 
140  send_report(); //call this once per sensor
141  }
142 
143  //seek to the new line character (since each rigid body is on its own line)
144  while (latestResponseStr[TXResponseStrIndex]!='\n') {
145  TXResponseStrIndex++;
146  }
147  TXResponseStrIndex++; // advance one more char as to be on the next line of text
148 
149  }// for
150 
151  return(gotAtLeastOneReport); //return 1 if something was sent, 0 otherwise
152 }
153 
154 
155 void vrpn_Tracker_NDI_Polaris::send_report(void) // called from get_report()
156 {
157  if (d_connection)
158  {
159  char msgbuf[VRPN_MSGBUFSIZE];
160  int len = encode_to(msgbuf);
163  fprintf(stderr,"vrpn_Tracker_NDI_Polaris: cannot write message: tossing\n");
164  }
165  }
166 }
167 
168 
169 // Send a command to the NDI tracker over the serial port.
170 // This assumes the serial port has already been opened.
171 // Some NDI commands require a white-space char at the end of the command, the
172 // call must be sure to add it.
173 // NDI commands end with a Carriage-return (\r) char. This function automatically adds it, and
174 // flushes the output buffer.
175 // commandString MUST be terminated with \0, since we don't know the string
176 // length otherwise.
177 // The NDI trackers have two different command syntaxes - this only supports the syntax
178 // WITHOUT CRC checksums
179 
180 void vrpn_Tracker_NDI_Polaris::sendCommand(const char* commandString ){
181  vrpn_write_characters(serialFd,(unsigned char* )commandString,strlen(commandString));
182  vrpn_write_characters(serialFd,(unsigned char* )"\r",1); //send the CR
184 }
185 
186 // Read a fully formed responses from the NDI tracker, (including the 4-byte CRC at the end)
187 // and copies it to latestResponseString.
188 // Returns the number of characters in the response (not including the CR),
189 // or -1 in case of an error
190 // NDI responses are all terminated with a CR, which this function replace with a end-of-string char.
191 //
192 // This function blocks until the CR has been received.
193 // FIXME: add a timeout parameter, and timeout if it's been too long
195  //read in characters one-at-a-time until we come across a CR
196  int charIndex=0;
197  bool foundCR=false;
198  unsigned char c;
199  while (!foundCR) {
201  latestResponseStr[charIndex]=c;
202  if (c=='\r') { //found CR
203  latestResponseStr[charIndex]='\0';
204  foundCR=true;
205  } else {
206  charIndex++;
207  }
208  }
209  }
210  return (charIndex);
211 }
212 
213 // Given a filename of a binary .rom file, this reads the file and returns
214 // a string with the contents of the file as ascii encoded hex: For each byte of
215 // the file, this returns two ascii characters, each of which are ascii representation
216 // of a HEX digit (0-9 & a-f). Hex letters are returned as lower case.
217 // The string is padded with zeros to make it's length a multiple of 128
218 // characters( which is 64 bytes of the original binary file).
219 // asciiEncodedHexStr must be allocated before calling, be
220 // MAX_NDI_FROM_FILE_SIZE_IN_BYTES * 2 characters long.
221 //
222 // RETURNS the number of bytes represented in the string (which is half the number of ASCII characters)
223 // , or -1 on failure
224 int vrpn_Tracker_NDI_Polaris::convertBinaryFileToAsciiEncodedHex(const char* filename, char *asciiEncodedHexStr) {
225 
226 
227  FILE* fptr=fopen(filename,"rb");
228  if (fptr==NULL) {
229  fprintf(stderr,"vrpn_Tracker_NDI_Polaris: can't open NDI .rom file %s\n",filename);
230  return (-1);
231  }
232 
233  // obtain file size:
234  fseek(fptr , 0 , SEEK_END);
235  long int fileSizeInBytes = ftell(fptr);
236  rewind(fptr);
237 
238  if (fileSizeInBytes>MAX_NDI_ROM_FILE_SIZE_IN_BYTES) {
239  fprintf(stderr,"vrpn_Tracker_NDI_Polaris: file is %ld bytes long - which is larger than expected NDI ROM file size of %d bytes.\n",
240  fileSizeInBytes,MAX_NDI_ROM_FILE_SIZE_IN_BYTES);
241  return (-1);
242  }
243 
244  // allocate memory to contain the whole file:
245  unsigned char* rawBytesFromRomFile = (unsigned char*) new unsigned char[fileSizeInBytes];
246 
247  // copy the file into the buffer:
248  size_t result = fread (rawBytesFromRomFile,1,fileSizeInBytes,fptr);
249  if (result != (unsigned int) fileSizeInBytes) {
250  fprintf(stderr,"vrpn_Tracker_NDI_Polaris: error while reading .rom file!\n");
251  fclose(fptr);
252  return(-1);
253  }
254  fclose(fptr);
255 
256 
257  // init array with "_" for debugging
258  for (int i=0; i<MAX_NDI_ROM_FILE_SIZE_IN_BYTES; i++) {
259  asciiEncodedHexStr[i]='_';
260  }
261  int byteIndex;
262  for (byteIndex=0; byteIndex<fileSizeInBytes; byteIndex++) {
263  sprintf(&(asciiEncodedHexStr[byteIndex*2]),"%02x ",rawBytesFromRomFile[byteIndex]);
264  }
265 
266  // pad the length to make it a multiple of 64
267  int numOfBytesToPadRemaining= NDI_ROMFILE_CHUNK_SIZE-(fileSizeInBytes% NDI_ROMFILE_CHUNK_SIZE);
268  if (numOfBytesToPadRemaining== NDI_ROMFILE_CHUNK_SIZE) {numOfBytesToPadRemaining=0;}
269 
270  int paddedFileSizeInBytes=fileSizeInBytes+numOfBytesToPadRemaining;
271 
272  while (numOfBytesToPadRemaining>0) {
273  asciiEncodedHexStr[byteIndex*2]='0';
274  asciiEncodedHexStr[byteIndex*2+1]='0';
275  byteIndex++;
276  numOfBytesToPadRemaining--;
277  }
278 
279  asciiEncodedHexStr[byteIndex*2]='\0'; //end of string marker, which is used just for debugging
280 
281  //printf("DEBUG: >>%s<<\n",asciiEncodedHexStr);
282  delete (rawBytesFromRomFile);
283 
284  return paddedFileSizeInBytes;
285 }
286 
287 // NDI response strings often encode ints as a two ascii's WITHOUT any separator behind it
288 // this returns the value as an int.
289 // The caller passes in the string, and a pointer to an (int) index into that string (which will be advanced
290 // to the end of the value we just parsed.
291 // The caller must make sure the string is at least two characters long
292 unsigned int vrpn_Tracker_NDI_Polaris::parse2CharIntFromNDIResponse(unsigned char* str, int* strIndexPtr) {
293  unsigned intVal;
294  if (strIndexPtr==NULL){ //if no index was passed in, start at the beginning of the string, and don't
295  //advance the index
296  sscanf((char*) str,"%2u",&intVal);
297  } else {
298  sscanf((char*) &(str[*strIndexPtr]),"%2u",&intVal);
299  *strIndexPtr+=2;
300  }
301  return (intVal);
302 }
303 
304 // NDI TX response strings often encode floats as a size ascii's WITHOUT any separator behind it
305 // this returns the value as an float. The last 4 digits are implicitly to the right of the decimal point
306 // (the decimal point itself is not in the string)
307 // The caller passes in the string, and a pointer to an (int) index into that string (which will be advanced
308 // to the end of the value we just parsed.
309 // The caller must make sure the string is at least six characters long
310 float vrpn_Tracker_NDI_Polaris::parse6CharFloatFromNDIResponse(unsigned char* str, int* strIndexPtr) {
311  int intVal;
312  sscanf((char*) &(str[*strIndexPtr]),"%6d",&intVal);
313  *strIndexPtr+=6;
314  return (intVal/10000.0f);
315 }
316 
317 // NDI TX response strings often encode floats as a size ascii's WITHOUT any separator behind it
318 // this returns the value as an float. The last 2 digits are implicitly to the right of the decimal point
319 // (the decimal point itself is not in the string)
320 // The caller passes in the string, and a pointer to an (int) index into that string (which will be advanced
321 // to the end of the value we just parsed.
322 // The caller must make sure the string is at least seven characters long
323 float vrpn_Tracker_NDI_Polaris::parse7CharFloatFromNDIResponse(unsigned char* str, int* strIndexPtr) {
324  int intVal;
325  sscanf((char*) &(str[*strIndexPtr]),"%7d",&intVal);
326  *strIndexPtr+=7;
327  return (intVal/100.0f);
328 }
329 
330 int vrpn_Tracker_NDI_Polaris::setupOneTool(const char* NDIToolRomFilename)
331 {
332  // For each tool (i.e. rigid body) that we want to track, we must first need to initialize a port handle (on the NDI machine)
333  // for that tool. This function does that. the caller must call it for each tool.
334  // This returns -1 on failure, or the tool number (i.e. port handle), which is 1 or greater (VRPN
335  // sensors start at 0, whereas NDI port handles start at 1).
336 
337  // We use the command
338  // sequence PHRQ -> PVWR -> PINIT -> PENA; we must do this for each tool we want tracked.
339 
340  // sending the PHRQ command first; this will assign a port handler number to the tracking device. the
341  // first 8 digits are the hardware device ID, but one can just use asterisks as wild cards. the 9th digit
342  // is system type, 0 for polaris or just *. the 10th digit needs to be a 1 with the passive tracking
343  // balls that we are using in this setup (0 for an active wired LED setup). 11th & 12th digits are to
344  // request a specific port number (we may as well do that here), and the last two are "reserved".
345  char commandStr[MAX_NDI_RESPONSE_LENGTH];
346 
347  sendCommand("PHRQ *********1****");
348  readResponse();
349 #ifdef DEBUG
350  printf("DEBUG: PHRQ response: >%s<\n",latestResponseStr);
351 #endif
352  if (strncmp("ERROR",(char *) latestResponseStr,5)==0) return (-1);
353 
354  unsigned int portHandleNum = parse2CharIntFromNDIResponse(latestResponseStr);
355 
356  //convert to ASCII-encoded hex, write to array of chars
357  char asciiEncodedHex[MAX_NDI_ROM_FILE_SIZE_IN_BYTES*2]; //each byte needs two digits, so we multiply by 2
358  int numOfFileBytes=convertBinaryFileToAsciiEncodedHex(NDIToolRomFilename,asciiEncodedHex);
359 
360  //feed that array of chars to NDI, but we must first divide it up into 64 byte (128 ascii char)
361  //"chunks", and send on chunk at a time.
362  int numOfChunks=numOfFileBytes/NDI_ROMFILE_CHUNK_SIZE;
363  for (int chunkIndex=0; chunkIndex<numOfChunks; chunkIndex++) {
364  char chunk[129]; //64*2 +1 for the end of string
365  strncpy(chunk,&(asciiEncodedHex[chunkIndex*NDI_ROMFILE_CHUNK_SIZE*2]),NDI_ROMFILE_CHUNK_SIZE*2);
366  chunk[128]='\0';
367 
368  int NDIAddress=chunkIndex*NDI_ROMFILE_CHUNK_SIZE; //the memory offset (in the NDI machine, not this PC)
369  // where this chunk will start
370  sprintf(commandStr,"PVWR %02u%04x%s",portHandleNum, NDIAddress,chunk);
371  //printf("DEBUG: >>%s<<\n",commandStr);
372  sendCommand(commandStr);
373  readResponse();
374 #ifdef DEBUG
375  printf("DEBUG: PVWR response: >%s<\n",latestResponseStr);
376 #endif
377  }
378  sprintf(commandStr,"PINIT %02u",portHandleNum); // initializes the port handle
379  sendCommand(commandStr);
380  readResponse();
381 #ifdef DEBUG
382  printf("DEBUG: PINIT response: >%s<\n",latestResponseStr); //this will be an error if PVWR hasn't been sent
383 #endif
384  if (strncmp("ERROR",(char *) latestResponseStr,5)==0) return (-1);
385 
386  sprintf(commandStr,"PENA %02uD",portHandleNum); //enables the port handle as a dynamic tool (expect motion)
387  sendCommand(commandStr);
388  readResponse();
389 #ifdef DEBUG
390  printf("DEBUG: PENA response: >%s<\n",latestResponseStr); //this will be an error if PINIT hasn't been sent
391 #endif
392  //FIXME: PENA returns warnings if the tool geometry has problems, Parse these warnings and return them
393  return(portHandleNum);
394 }
395 
397  printf("vrpn_Tracker_NDI_Polaris: Switching NDI to higher baud rate, and then reopening com port at higher rate...");
398  sendCommand("COMM 70000"); // 1.2Mbit (1228739 baud), which requires the NDI USB 2.0 adapter
399  readResponse();
400 #ifdef DEBUG
401  printf("DEBUG: COMM response: >%s<\n",latestResponseStr);
402 #endif
403  //if the response is "RESET", try again
404  if (strncmp("RESET",(char *) latestResponseStr,5)==0) {
405  //we got a reset, which means the track reset itself (without being commanded too?)
406  sendCommand("COMM 70000"); // 1.2Mbit, which requires the NDI USB 2.0 adapter
407  readResponse();
408  //printf("DEBUG: COMM response: >%s<\n",latestResponseStr);
409  }
410  vrpn_SleepMsecs(100); //we should wait 100 msec after getting the OKAY from the NDI before changing the PC's comm rate
411 
413 #ifdef _WIN32
414  serialFd=vrpn_open_commport(port,19200); //19.2k is aliased to 1.2Mbit in the Window's version of the NDI USB virtual com port driver
415 #else
416  serialFd=vrpn_open_commport(port,1228739); //should work on linux (UNTESTED!)
417 #endif
418  printf("done\n");
419 }
420 
421 
vrpn_Tracker.h
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_Tracker
Definition: vrpn_Tracker.h:49
vrpn_Tracker::encode_to
virtual int encode_to(char *buf)
Definition: vrpn_Tracker.C:533
vrpn_Tracker::d_sensor
vrpn_int32 d_sensor
Definition: vrpn_Tracker.h:94
vrpn_Types.h
vrpn_Tracker_NDI_Polaris::parse7CharFloatFromNDIResponse
float parse7CharFloatFromNDIResponse(unsigned char *str, int *strIndexPtr)
Definition: vrpn_Tracker_NDI_Polaris.C:323
vrpn_set_rts
int vrpn_set_rts(int comm)
Definition: vrpn_Serial.C:365
vrpn_Tracker_NDI_Polaris::sendCommand
void sendCommand(const char *commandString)
Definition: vrpn_Tracker_NDI_Polaris.C:180
vrpn_Tracker::d_quat
vrpn_float64 d_quat[4]
Definition: vrpn_Tracker.h:95
vrpn_Tracker_NDI_Polaris::mainloop
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
Definition: vrpn_Tracker_NDI_Polaris.C:99
vrpn_Tracker_NDI_Polaris::numOfRigidBodies
int numOfRigidBodies
Definition: vrpn_Tracker_NDI_Polaris.h:108
vrpn_Tracker::timestamp
struct timeval timestamp
Definition: vrpn_Tracker.h:100
vrpn_Tracker_NDI_Polaris.h
vrpn_Tracker_NDI_Polaris::send_report
virtual void send_report(void)
Definition: vrpn_Tracker_NDI_Polaris.C:155
vrpn_Serial.h
vrpn_Serial: Pulls all the serial port routines into one file to make porting to new operating system...
vrpn_Tracker_NDI_Polaris::switchToHigherBaudRate
void switchToHigherBaudRate(const char *port)
Definition: vrpn_Tracker_NDI_Polaris.C:396
vrpn_Tracker_NDI_Polaris::parse6CharFloatFromNDIResponse
float parse6CharFloatFromNDIResponse(unsigned char *str, int *strIndexPtr)
Definition: vrpn_Tracker_NDI_Polaris.C:310
vrpn_CONNECTION_LOW_LATENCY
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
Definition: vrpn_Connection.h:122
vrpn_BaseClassUnique::d_connection
vrpn_Connection * d_connection
Connection that this object talks to.
Definition: vrpn_BaseClass.h:224
vrpn_flush_input_buffer
int vrpn_flush_input_buffer(int comm)
Throw out any characters within the input buffer.
Definition: vrpn_Serial.C:435
vrpn_SleepMsecs
void vrpn_SleepMsecs(double dMsecs)
Definition: vrpn_Shared.C:157
vrpn_Shared.h
vrpn_Tracker_NDI_Polaris::VRPN_MSGBUFSIZE
@ VRPN_MSGBUFSIZE
Definition: vrpn_Tracker_NDI_Polaris.h:104
vrpn_Tracker_NDI_Polaris::vrpn_Tracker_NDI_Polaris
vrpn_Tracker_NDI_Polaris(const char *name, vrpn_Connection *c, const char *port, int numOfRigidBodies, const char **rigidBodyNDIRomFileNames)
The constructor is given the name of the tracker (the name of the sender it should use),...
Definition: vrpn_Tracker_NDI_Polaris.C:12
vrpn_BaseClassUnique::d_sender_id
vrpn_int32 d_sender_id
Sender ID registered with the connection.
Definition: vrpn_BaseClass.h:228
vrpn_Tracker_NDI_Polaris::MAX_NDI_RESPONSE_LENGTH
@ MAX_NDI_RESPONSE_LENGTH
Definition: vrpn_Tracker_NDI_Polaris.h:103
vrpn_Tracker_NDI_Polaris::readResponse
int readResponse()
Definition: vrpn_Tracker_NDI_Polaris.C:194
vrpn_Tracker_NDI_Polaris::get_report
virtual int get_report(void)
Definition: vrpn_Tracker_NDI_Polaris.C:109
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_Tracker_NDI_Polaris::serialFd
int serialFd
Definition: vrpn_Tracker_NDI_Polaris.h:107
vrpn_gettimeofday
#define vrpn_gettimeofday
Definition: vrpn_Shared.h:89
vrpn_read_available_characters
int vrpn_read_available_characters(int comm, unsigned char *buffer, size_t bytes)
Definition: vrpn_Serial.C:512
vrpn_close_commport
int vrpn_close_commport(int comm)
Definition: vrpn_Serial.C:345
vrpn_Tracker_NDI_Polaris::~vrpn_Tracker_NDI_Polaris
~vrpn_Tracker_NDI_Polaris()
Definition: vrpn_Tracker_NDI_Polaris.C:94
vrpn_Tracker_NDI_Polaris::setupOneTool
int setupOneTool(const char *NDIToolRomFilename)
Definition: vrpn_Tracker_NDI_Polaris.C:330
vrpn_Tracker_NDI_Polaris::NDI_ROMFILE_CHUNK_SIZE
@ NDI_ROMFILE_CHUNK_SIZE
Definition: vrpn_Tracker_NDI_Polaris.h:101
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
vrpn_Tracker_NDI_Polaris::latestResponseStr
unsigned char * latestResponseStr
Definition: vrpn_Tracker_NDI_Polaris.h:109
vrpn_Tracker_NDI_Polaris::MAX_NDI_ROM_FILE_SIZE_IN_BYTES
@ MAX_NDI_ROM_FILE_SIZE_IN_BYTES
Definition: vrpn_Tracker_NDI_Polaris.h:102
vrpn_Tracker::pos
vrpn_float64 pos[3]
Definition: vrpn_Tracker.h:95
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
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_Tracker_NDI_Polaris::convertBinaryFileToAsciiEncodedHex
int convertBinaryFileToAsciiEncodedHex(const char *filename, char *asciiEncodedHexStr)
Definition: vrpn_Tracker_NDI_Polaris.C:224
vrpn_Tracker_NDI_Polaris::parse2CharIntFromNDIResponse
unsigned int parse2CharIntFromNDIResponse(unsigned char *str, int *strIndexPtr=NULL)
Definition: vrpn_Tracker_NDI_Polaris.C:292
vrpn_clear_rts
int vrpn_clear_rts(int comm)
Definition: vrpn_Serial.C:399