vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Tracker_LibertyHS.h
Go to the documentation of this file.
1 // vrpn_Tracker_LibertyHS.h
2 // This file contains the class header for a High Speed Polhemus Liberty
3 // Latus Tracker.
4 // This file is based on the vrpn_Tracker_Liberty.h file, with modifications made
5 // to allow it to operate a Liberty Latus instead. It has been tested on Linux.
6 
7 #ifndef VRPN_TRACKER_LIBERTYHS_H
8 #define VRPN_TRACKER_LIBERTYHS_H
9 
10 #include <stdio.h> // for NULL
11 
12 #include "vrpn_Configure.h" // for VRPN_API, etc
13 #include "vrpn_Shared.h" // for timeval
14 #include "vrpn_Tracker.h" // for vrpn_Tracker_USB
15 #include "vrpn_Types.h" // for vrpn_uint16, vrpn_uint8, etc
16 
18 
19 #if defined(VRPN_USE_LIBUSB_1_0)
20 
21 // Vendor and product IDs for High Speed Liberty Latus tracker
22 static const vrpn_uint16 LIBERTYHS_VENDOR_ID = 0x0f44;
23 static const vrpn_uint16 LIBERTYHS_PRODUCT_ID = 0xff20;
24 
25 // Endpoints to communicate with the USB device
26 static const vrpn_uint8 LIBERTYHS_WRITE_EP = 0x04;
27 static const vrpn_uint8 LIBERTYHS_READ_EP = 0x88;
28 
29 const int vrpn_LIBERTYHS_MAX_STATIONS = 8; //< How many stations (i.e. markers) can exist
30 const int vrpn_LIBERTYHS_MAX_WHOAMI_LEN = 1024; //< Maximum whoami response length
31 const int vrpn_LIBERTYHS_MAX_MARKERMAP_LEN = 12; //< Maximum active marker map response length
32 
33 
35 
36  public:
37 
49 
50  vrpn_Tracker_LibertyHS(const char *name, vrpn_Connection *c,
51  long baud = 115200, int enable_filtering = 1,
52  int numstations = vrpn_LIBERTYHS_MAX_STATIONS,
53  int receptoridx = 1, const char *additional_reset_commands = NULL,
54  int whoamilen = 288);
55 
57 
58  protected:
59 
60  virtual int get_report(void);
61  virtual void reset();
62 
63 
64  int do_filter; //< Should we turn on filtering for pos/orient?
65  int num_stations; //< How many stations (trackers) on this LibertyHS?
66  int receptor_index; //< Index of receptor used to detect and launch the markers
67  int num_resets; //< Number of resets we've tried this time.
68  char add_reset_cmd[2048]; //< Additional reset commands to be sent
69  int whoami_len; //< Number of chars in whoami response
70  int read_len; //< Number of bytes in usb read buffer
71  int sync_index; //< Index of first sync char in usb read buffer
72 
73  struct timeval liberty_zerotime; //< When the liberty time counter was zeroed
74  struct timeval liberty_timestamp; //< The time returned from the LibertyHS System
75  vrpn_uint32 REPORT_LEN; //< The length that the current report should be
76 
77 
79  int set_sensor_output_format(int sensor = -1);
80 
82  int report_length(int sensor);
83 
85  int write_usb_data(void* data,int len);
86 
91  int read_usb_data(void* data,int maxlen,unsigned int timeout = 50);
92 
94  void flush_usb_data();
95 
97  int test_markers();
98 
100  int launch_markers();
101 };
102 
103 // End of LIBUSB
104 #endif
105 
106 // End of VRPN_TRACKER_LIBERTYHS_H
107 #endif
vrpn_Tracker.h
vrpn_Tracker_LibertyHS::receptor_index
int receptor_index
Definition: vrpn_Tracker_LibertyHS.h:66
vrpn_Tracker_LibertyHS::read_len
int read_len
Definition: vrpn_Tracker_LibertyHS.h:70
vrpn_LIBERTYHS_MAX_MARKERMAP_LEN
const int vrpn_LIBERTYHS_MAX_MARKERMAP_LEN
Definition: vrpn_Tracker_LibertyHS.h:31
vrpn_Types.h
vrpn_LIBERTYHS_MAX_STATIONS
const int vrpn_LIBERTYHS_MAX_STATIONS
Definition: vrpn_Tracker_LibertyHS.h:29
vrpn_Tracker_LibertyHS::num_resets
int num_resets
Definition: vrpn_Tracker_LibertyHS.h:67
vrpn_Tracker_LibertyHS::REPORT_LEN
vrpn_uint32 REPORT_LEN
Definition: vrpn_Tracker_LibertyHS.h:75
vrpn_Tracker_LibertyHS::sync_index
int sync_index
Definition: vrpn_Tracker_LibertyHS.h:71
vrpn_Tracker_USB::get_report
virtual int get_report(void)=0
Gets reports if some are available, returns 0 if not, 1 if complete report(s).
vrpn_Tracker_LibertyHS::whoami_len
int whoami_len
Definition: vrpn_Tracker_LibertyHS.h:69
vrpn_Shared.h
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition: vrpn_Connection.h:510
vrpn_Tracker_LibertyHS
Definition: vrpn_Tracker_LibertyHS.h:34
vrpn_Tracker_USB
Definition: vrpn_Tracker.h:181
vrpn_Tracker_USB::reset
virtual void reset(void)=0
Reset the tracker.
vrpn_Configure.h
vrpn_LIBERTYHS_MAX_WHOAMI_LEN
const int vrpn_LIBERTYHS_MAX_WHOAMI_LEN
Definition: vrpn_Tracker_LibertyHS.h:30
vrpn_Tracker_LibertyHS::do_filter
int do_filter
Definition: vrpn_Tracker_LibertyHS.h:64
vrpn_Tracker_LibertyHS::num_stations
int num_stations
Definition: vrpn_Tracker_LibertyHS.h:65
VRPN_API
#define VRPN_API
Definition: vrpn_Configure.h:646