00001
00009
00010 #ifdef USE_VRPN
00011
00012 #ifndef VRPNTRACKERDEVICE_H
00013 #define VRPNTRACKERDEVICE_H
00014
00015
00016 #include <G3D/G3DAll.h>
00017 #include "InputDevice.H"
00018
00019
00020 class vrpn_Tracker_Remote;
00021
00022 namespace VRG3D {
00023
00059 class VRPNTrackerDevice : public InputDevice
00060 {
00061 public:
00062
00063 VRPNTrackerDevice(
00064 const std::string &vrpnTrackerDeviceName,
00065 const Array<std::string> &eventsToGenerate,
00066 const double &trackerUnitsToRoomUnitsScale,
00067 const CoordinateFrame &deviceToRoom,
00068 const Array<CoordinateFrame> &propToTracker,
00069 const Array<CoordinateFrame> &finalOffset,
00070 const bool &waitForNewReportInPoll,
00071 const bool &convertLHtoRH = false);
00072
00073 virtual ~VRPNTrackerDevice();
00074
00075 void processEvent(const CoordinateFrame &vrpnEvent, int sensorNum);
00076
00077 std::string getEventName(int trackerNumber);
00078
00079 void pollForInput(Array<EventRef> &events);
00080
00081 void setPrintSensor0(bool b) { _printSensor0 = b; }
00082
00083 private:
00084 vrpn_Tracker_Remote *_vrpnDevice;
00085 Array<std::string> _eventNames;
00086 double _trackerUnitsToRoomUnitsScale;
00087 CoordinateFrame _deviceToRoom;
00088 Array<CoordinateFrame> _propToTracker;
00089 Array<CoordinateFrame> _finalOffset;
00090 bool _printSensor0;
00091 bool _waitForNewReport;
00092 bool _convertLHtoRH;
00093 bool _newReportFlag;
00094 Array<EventRef> _pendingEvents;
00095 };
00096
00097 }
00098
00099 #endif
00100
00101
00102 #endif // USE_VRPN
00103