00001
00015
00016 #ifdef USE_VRPN
00017
00018 #ifndef VRPNTRACKERDEVICE_H
00019 #define VRPNTRACKERDEVICE_H
00020
00021
00022 #include <G3D/G3DAll.h>
00023 using namespace G3D;
00024 #include <iostream>
00025 #include "IS3DCommon.H"
00026 #include "PolledDevice.H"
00027
00028 class vrpn_Tracker_Remote;
00029
00030 namespace IS3D {
00031
00032
00069 class VRPNTrackerDevice : public PolledDevice
00070 {
00071 public:
00072
00073 VRPNTrackerDevice(
00074 const std::string &vrpnTrackerDeviceName,
00075 const Array<std::string> &eventsToGenerate,
00076 const double &trackerUnitsToRoomUnitsScale,
00077 const CoordinateFrame &deviceToRoom,
00078 const Array<CoordinateFrame> &propToTracker,
00079 const Array<CoordinateFrame> &finalOffset);
00080
00081
00082 static VRPNTrackerDevice* fromConfigVals(const std::string &devname);
00083
00084 virtual ~VRPNTrackerDevice();
00085
00086 void processEvent(const CoordinateFrame &vrpnEvent, int sensorNum);
00087
00088 std::string getEventName(int trackerNumber);
00089
00090 void pollForEvents();
00091
00092 void setFinalOffset(int trackerNumber, CoordinateFrame &finalOffset);
00093
00094 private:
00095
00096 vrpn_Tracker_Remote *_vrpnDevice;
00097 Array<std::string> _eventNames;
00098 double _trackerUnitsToRoomUnitsScale;
00099 CoordinateFrame _deviceToRoom;
00100 Array<CoordinateFrame> _propToTracker;
00101 Array<CoordinateFrame> _finalOffset;
00102 bool _printSensor0;
00103 };
00104
00105 }
00106
00107 #endif
00108
00109
00110 #endif // USE_VRPN
00111