00001 /* 00002 This file is part of the Virtual Object System of 00003 the Interreality project (http://interreality.org). 00004 00005 Copyright (C) 2001, 2002 Peter Amstutz 00006 00007 This software was written at the University of Massachusetts with 00008 support from NSF grant #EIA 9703217 00009 00010 This library is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU Lesser General Public 00012 License as published by the Free Software Foundation; either 00013 version 2 of the License, or (at your option) any later version. 00014 00015 This library is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this library; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 00024 Peter Amstutz <tetron@interreality.org> 00025 */ 00026 #ifndef _INTERSENSEORIENTATION_HH_ 00027 #define _INTERSENSEORIENTATION_HH_ 00028 00029 #include <fcntl.h> 00030 #include <termios.h> 00031 #include <stdio.h> 00032 00033 #include "orientation.hh" 00034 00035 00036 00037 00038 /** Implementation of Orientation which gets info from an Intersense IS-300 00039 * tracking device. 00040 * 00041 * @bug There is no timeout reading from the IS; everything hangs if there is no 00042 * response (e.g. IS is turned off) 00043 */ 00044 class IntersenseOrientation : public Orientation 00045 { 00046 private: 00047 struct termios oldtio, newtio; 00048 FILE* filep; 00049 int fd; 00050 public: 00051 00052 IntersenseOrientation(const char* dev = "/dev/isense", int bps = 115200) throw (DeviceError); 00053 virtual ~IntersenseOrientation(); 00054 virtual void getOrientationMatrix(double mat[3][3]) throw(DeviceError); 00055 virtual void getEulerAngles(double* yaw, double* pitch, double* roll) throw(DeviceError); 00056 }; 00057 00058 00059 #endif