// vrpn_Tracker_Fastrak.h
// This file contains the class header for a Polhemus Fastrak Tracker.
// This file is based on the vrpn_3Space.h file, with modifications made
// to allow it to operate a Fastrak instead. The modifications are based
// on the old version of the Fastrak driver, which had been mainly copied
// from the Trackerlib driver and was very difficult to understand.
// This version was written in the Summer of 1999 by Russ Taylor.
// Later, it was updated to allow the extended reset commands needed
// to drive an IS-600 tracker.
// Later (Summer of 2000), it was augmented to allow the button, analog,
// and timestamp capabilities of the InterSense IS-900 tracker.
#ifndef VRPN_TRACKER_FASTRAK_H
#define VRPN_TRACKER_FASTRAK_H
#include <time.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#ifndef _WIN32
#include <sys/time.h>
#endif
#include "vrpn_Tracker.h"
#include "vrpn_Button.h"
#include "vrpn_Analog.h"
const int vrpn_FASTRAK_MAX_STATIONS = 4; //< How many stations can exist
class vrpn_Tracker_Fastrak: public vrpn_Tracker_Serial {
public:
vrpn_Tracker_Fastrak(const char *name, vrpn_Connection *c,
const char *port = "/dev/ttyS1", long baud = 19200,
int enable_filtering = 1, int numstations = vrpn_FASTRAK_MAX_STATIONS,
const char *additional_reset_commands = NULL,
int is900_timestamps = 0);
~vrpn_Tracker_Fastrak();
int add_is900_button(const char *button_device_name, int sensor, int numbuttons = 5);
int add_is900_analog(const char *analog_device_name, int sensor,
double c0Min = -1, double c0Low = 0, double c0Hi = 0, double c0Max = 1,
double c1Min = -1, double c1Low = 0, double c1Hi = 0, double c1Max = 1);
protected:
virtual int get_report(void);
virtual void reset();
void swap_endian4(char *buffer);
struct timeval reset_time;
int do_filter; //< Should we turn on filtering for pos/orient?
int num_stations; //< How many stations maximum on this Fastrak?
char add_reset_cmd[2048]; //< Additional reset commands to be sent
// The following members provide support for the InterSense IS-900 features
// that are beyond the standard Fastrak features.
int do_is900_timestamps; //< Request and process IS-900 timestamps?
struct timeval is900_zerotime; //< When the IS-900 time counter was zeroed
vrpn_Button_Server *is900_buttons[vrpn_FASTRAK_MAX_STATIONS]; //< Pointer to button on each sensor (NULL if none)
vrpn_Clipping_Analog_Server *is900_analogs[vrpn_FASTRAK_MAX_STATIONS]; //< Pointer to analog on each sensor (NULL if none)
vrpn_uint32 REPORT_LEN; //< The length that the current report should be
int set_sensor_output_format(int sensor);
int report_length(int sensor);
};
#endif