vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Flock.h
Go to the documentation of this file.
1 #ifndef FLOCK_H
2 #define FLOCK_H
3 
4 #include "vrpn_Configure.h" // for VRPN_API
5 #include "vrpn_Shared.h" // for timeval
6 #include "vrpn_Tracker.h" // for vrpn_Tracker_Serial
7 
9 
10 // only 13 receivers allowed in normal addressing mode
11 #define VRPN_FLOCK_MAX_SENSORS 13
12 
13 // This is a class which provides a server for an Ascension
14 // Flock of Birds tracker. The server will send out messages
15 // at whatever rate the flock of bird's stream mode feeds them.
16 // Default filtering is active.
17 // The timestamp is the time when the first character was read
18 // from the serial driver with "read". No adjustment is currently
19 // made to this time stamp.
20 
21 // Adelstein, et al, "Dynamic response of electromagnetic spatial
22 // displacement trackers", Presence 5(3) found that if all of the filters
23 // are turned off, and the time required to transport the data to the
24 // server is ignored, then the latency of the flock is about 2 ms for ori,
25 // 7.5 ms for pos for the 0-4hz range (ie, when the data is ready to leave
26 // the flock in stream mode, the pos is 7.5 ms old, and the ori is 2 ms
27 // old). Later this data will be combined with the baud rate to provide a
28 // more accurate time stamp for certain flock modes.
29 
30 // If this is running on a non-linux system, then the serial port driver
31 // is probably adding more latency -- see the vrpn README for more info.
32 
33 // The FOB now doesn't need to be used in a chain starting with an Exteded
34 // range controller. You may use the optionnal useERT to set whether this
35 // is the case or not. Added by David Nahon, for Virtools VR Pack,
36 // david@z-a.net, support@virtools.com
37 
39 
40  public:
41  vrpn_Tracker_Flock(char *name, vrpn_Connection *c, int cSensors=1,
42  const char *port = "/dev/ttyd3", long baud = 38400,
43  int fStreamMode = 1, int useERT=1, bool invertQuaternion = false, int active_hemisphere=HEMI_PLUSZ);
44  virtual ~vrpn_Tracker_Flock();
45 
46  enum {HEMI_PLUSX, HEMI_MINUSX, HEMI_PLUSY, HEMI_MINUSY, HEMI_PLUSZ, HEMI_MINUSZ};
47 
48  protected:
49 
51 
52  virtual int get_report(void);
53  virtual void send_report(void);
54  virtual void reset();
55  void printError(unsigned char uchErrCode, unsigned char uchExpandedErrCode);
56  int checkError();
57  int cSensors;
58  int fStream; // stream or polled mode
59  int fGroupMode; // for get_report -- group report mode or individual
60 
61  int d_useERT; // do we have an extended range transmitter, this was the default
62  bool d_invertQuaternion; // Do we invert the Quaternion before returning it?
63 
64  // class members used to help with error recovery
65  unsigned cResets;
66  unsigned cSyncs;
67 
68  // class members used for statistics only
70  struct timeval tvLastStatusReport;
71  int cReports;
73  double getMeasurementRate();
74 };
75 
76 #endif
vrpn_Tracker.h
vrpn_Tracker_Flock::cSensors
int cSensors
Definition: vrpn_Flock.h:57
vrpn_Tracker_Flock::cReports
int cReports
Definition: vrpn_Flock.h:71
vrpn_Tracker_Flock::fGroupMode
int fGroupMode
Definition: vrpn_Flock.h:59
vrpn_Tracker_Flock::d_invertQuaternion
bool d_invertQuaternion
Definition: vrpn_Flock.h:62
vrpn_Shared.h
vrpn_Tracker_Serial::send_report
virtual void send_report(void)
Definition: vrpn_Tracker.C:885
vrpn_Tracker_Flock::fFirstStatusReport
int fFirstStatusReport
Definition: vrpn_Flock.h:69
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition: vrpn_Connection.h:510
vrpn_Tracker_Flock::cSyncs
unsigned cSyncs
Definition: vrpn_Flock.h:66
vrpn_Tracker_Flock::d_useERT
int d_useERT
Definition: vrpn_Flock.h:61
vrpn_Tracker_Flock::activeHemisphere
int activeHemisphere
Definition: vrpn_Flock.h:50
vrpn_Tracker_Flock::HEMI_PLUSZ
@ HEMI_PLUSZ
Definition: vrpn_Flock.h:46
vrpn_Tracker_Flock::fStream
int fStream
Definition: vrpn_Flock.h:58
vrpn_Tracker_Serial
Definition: vrpn_Tracker.h:144
vrpn_Tracker_Flock::cResets
unsigned cResets
Definition: vrpn_Flock.h:65
vrpn_Configure.h
vrpn_Tracker_Flock
Definition: vrpn_Flock.h:38
vrpn_Tracker_Flock::cStatusInterval
int cStatusInterval
Definition: vrpn_Flock.h:72
VRPN_API
#define VRPN_API
Definition: vrpn_Configure.h:646
vrpn_Tracker_Serial::get_report
virtual int get_report(void)=0
Gets a report if one is available, returns 0 if not, 1 if complete report.
vrpn_Tracker_Serial::reset
virtual void reset(void)=0
Reset the tracker.