vrpn 07.35
Virtual Reality Peripheral Network
 
Loading...
Searching...
No Matches
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
21const int vrpn_LIBERTY_MAX_STATIONS = 8; //< How many stations can exist
22const 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
Generic connection class not specific to the transport mechanism.
vrpn_Tracker_Liberty(const char *name, vrpn_Connection *c, const char *port="/dev/ttyS0", long baud=115200, int enable_filtering=1, int numstations=vrpn_LIBERTY_MAX_STATIONS, const char *additional_reset_commands=NULL, int whoamilen=195)
The constructor is given the name of the tracker (the name of the sender it should use),...
vrpn_Button_Server * stylus_buttons[vrpn_LIBERTY_MAX_STATIONS]
struct timeval liberty_zerotime
int report_length(int sensor)
Augments the basic Liberty report length.
int add_stylus_button(const char *button_device_name, int sensor, int numbuttons=1)
Add a stylus (with button) to one of the sensors.
int set_sensor_output_format(int sensor)
Augments the basic Liberty format.
struct timeval liberty_timestamp
virtual void reset(void)=0
Reset the tracker.
virtual int get_report(void)=0
Gets a report if one is available, returns 0 if not, 1 if complete report.
vrpn_Tracker_Serial(const char *name, vrpn_Connection *c, const char *port="/dev/ttyS1", long baud=38400)
#define VRPN_API
const int vrpn_LIBERTY_MAX_STATIONS
const int vrpn_LIBERTY_MAX_WHOAMI_LEN
class VRPN_API vrpn_Connection
class VRPN_API vrpn_Button_Server