00001 /* 00002 Object Oriented Mobile Robot Model (OOMRM) C++ Library Copyright (C) 2002-2005 Derek Jones 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Lesser General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public 00015 License along with this library; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 $Id: osonar.h,v 1.1.1.1 2006/05/11 05:22:41 derek Exp $ 00019 00020 Version 1.1: 00021 1. Added _distance and _value() method. (11/19/02) 00022 00023 */ 00024 #ifndef _SONARDV_H 00025 #define _SONARDV_H 00026 #include <hardware/odio1.h> 00027 #include <hardware/odio1_tpu.h> 00028 #include <hardware/oencoder.h> 00029 #include <hardware/opta.h> 00030 #define INT_MILLIMETER int 00031 00032 00064 #ifdef DOS 00065 class oSonarDV 00066 #else 00067 class oSonarDV : public oPTA 00068 #endif 00069 { 00070 public: 00076 oSonarDV(IOLINE channel, PORT port, IOLINE itpu); 00077 void ping(void); 00078 INT_MILLIMETER value(void); 00079 // int maximum_sensor_range(void); 00080 #ifdef JAUS 00081 00082 void status(JAUS_STATE istat); 00083 #endif 00084 protected: 00085 oSonarDV(void); 00086 INT_MILLIMETER _value(void); 00087 JAUS_STATE _status; // status is available whether we have jaus defined or not. 00088 private: 00089 // oDI1_TPU _TPU; /* tpu channel the PTA function is on */ 00090 oEncoder _TPU; /* tpu channel the PTA function is on */ 00091 IOLINE _tpu_channel; // oDIO objects don't track what channel their on. 00092 oDO1 _control; /* set/reset pin for the sonar */ 00093 INT_MILLIMETER _distance; // final result of ping. 00094 }; 00095 #endif
1.3