vrpn
07.33
Virtual Reality Peripheral Network
|
Go to the documentation of this file.
22 #define T_PDYN_SPEW_MODE (-50)
23 #define T_PDYN_NO_DATA (-51)
25 #define lOOO_OOOO (0x80)
26 #define llll_OOOO (0xf0)
27 #define OOOO_OOll (0x03)
28 #define OOOO_llOO (0x0c)
32 const char *port,
long baud ) :
39 fprintf(stderr,
"\nvrpn_Tracker_Dyna: starting up ...");
44 fprintf(stderr,
"vrpn_Tracker_Dyna:Shutting down...\n");
48 int vrpn_Tracker_Dyna::get_status()
51 unsigned char statusBuffer[256];
90 fprintf(stderr,
"3\n");
105 static const char T_PDYN_C_CTL_C[4] =
"\003\003\003";
106 static const int T_PDYN_RECORD_LENGTH = 8;
121 fprintf(stderr,
"vrpn_Tracker_Dyna::reset(): no data (is tracker turned on?)\n");
128 fprintf(stderr,
"vrpn_Tracker_Dyna: return valid status report\n");
129 reportLength = T_PDYN_RECORD_LENGTH;
164 fprintf(stderr,
"%s@%d: Error reading\n", __FILE__, __LINE__);
174 if (!valid_report()) {
188 int vrpn_Tracker_Dyna::valid_report() {
198 for (
unsigned i = 2; i <reportLength-1; i += 2)
204 "vrpn_Tracker_Dyna: found two more status bytes in the Dynasight's output list\n");
223 fprintf(stderr,
"trackerlib: Invalid target number for passive Dynasight\n");
250 int vrpn_Tracker_Dyna::decode_record()
256 char x_high, y_high, z_high;
257 unsigned char x_low, y_low, z_low;
262 fprintf(stderr,
"bogus data to vrpn_Tracker_Dyna_decode_record:\n");
263 for ( i = 0; i < reportLength; i++ )
264 fprintf(stderr,
"%x ",
buffer[i]);
265 fprintf(stderr,
"\n");
271 exp = (
unsigned char)( ( (
buffer[0] & 0x2)<<1 ) | (
buffer[0] & 0x1) );
282 x = (long)( ((
short)x_high<<8) | ((
short)x_low) ) << exp;
283 y = (long)( ((
short)y_high<<8) | ((
short)y_low) ) << exp;
284 z = (long)( ((
short)z_high<<8) | ((
short)z_low) ) << exp;
288 pos[0] = (double)x * 0.00005;
289 pos[1] = (double)y * 0.00005;
290 pos[2] = (double)z * 0.00005;
virtual ~vrpn_Tracker_Dyna()
unsigned char buffer[VRPN_TRACKER_BUF_SIZE]
int vrpn_drain_output_buffer(int comm)
Wait until all of the characters in the output buffer are sent, then return.
vrpn_Serial: Pulls all the serial port routines into one file to make porting to new operating system...
void vrpn_SleepMsecs(double dMsecs)
const int vrpn_TRACKER_PARTIAL
Generic connection class not specific to the transport mechanism.
const int vrpn_TRACKER_FAIL
const int vrpn_TRACKER_RESETTING
#define vrpn_gettimeofday
virtual void reset()
Reset the tracker.
int vrpn_read_available_characters(int comm, unsigned char *buffer, size_t bytes)
const int vrpn_TRACKER_SYNCING
vrpn_Tracker_Dyna(char *name, vrpn_Connection *c, int cSensors=1, const char *port="/dev/ttyd3", long baud=38400)
virtual int get_report(void)
Gets a report if one is available, returns 0 if not, 1 if complete report.
int vrpn_write_characters(int comm, const unsigned char *buffer, size_t bytes)
Write the buffer to the serial port.
#define VRPN_DYNA_MAX_SENSORS