vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Tracker_Liberty.h
Go to the documentation of this file.
1 // vrpn_Tracker_Liberty.h
2 // This file contains the class header for a Polhemus Liberty Tracker.
3 // This file is based on the vrpn_Tracker_Fastrak.h file, with modifications made
4 // to allow it to operate a Liberty instead.
5 // It has been tested on Linux and relies on being able to open the USB
6 // port as a named port and using serial commands to communicate with it.
7 
8 #ifndef VRPN_TRACKER_LIBERTY_H
9 #define VRPN_TRACKER_LIBERTY_H
10 
11 #include <stdio.h> // for NULL
12 
13 #include "vrpn_Configure.h" // for VRPN_API
14 #include "vrpn_Shared.h" // for timeval
15 #include "vrpn_Tracker.h" // for vrpn_Tracker_Serial
16 #include "vrpn_Types.h" // for vrpn_uint32
17 
20 
21 const int vrpn_LIBERTY_MAX_STATIONS = 8; //< How many stations can exist
22 const int vrpn_LIBERTY_MAX_WHOAMI_LEN = 1024; //< Maximum whoami response length
23 
25 
26  public:
27 
41 
42  vrpn_Tracker_Liberty(const char *name, vrpn_Connection *c,
43  const char *port = "/dev/ttyS0", long baud = 115200,
44  int enable_filtering = 1, int numstations = vrpn_LIBERTY_MAX_STATIONS,
45  const char *additional_reset_commands = NULL, int whoamilen = 195);
46 
48 
50  int add_stylus_button(const char *button_device_name,
51  int sensor, int numbuttons = 1);
52  protected:
53 
54  virtual int get_report(void);
55  virtual void reset();
56 
57  struct timeval reset_time;
58  int do_filter; //< Should we turn on filtering for pos/orient?
59  int num_stations; //< How many stations maximum on this Liberty?
60  int num_resets; //< How many resets we've tried this time.
61  char add_reset_cmd[2048]; //< Additional reset commands to be sent
64 
65  struct timeval liberty_zerotime; //< When the liberty time counter was zeroed
66  struct timeval liberty_timestamp; //< The time returned from the Liberty System
67  vrpn_uint32 REPORT_LEN; //< The length that the current report should be
68 
69  vrpn_Button_Server *stylus_buttons[vrpn_LIBERTY_MAX_STATIONS]; //< Pointer to button on each sensor (NULL if none)
70 
72  int set_sensor_output_format(int sensor);
73 
75  int report_length(int sensor);
76 };
77 
78 #endif
virtual int get_report(void)=0
Gets a report if one is available, returns 0 if not, 1 if complete report.
virtual void reset(void)=0
Reset the tracker.
Generic connection class not specific to the transport mechanism.
#define VRPN_API
const int vrpn_LIBERTY_MAX_STATIONS
const int vrpn_LIBERTY_MAX_WHOAMI_LEN