00001 /*************************************************************************** 00002 tag: Peter Soetens Thu Apr 22 20:40:58 CEST 2004 FakeEncoder.hpp 00003 00004 FakeEncoder.hpp - description 00005 ------------------- 00006 begin : Thu April 22 2004 00007 copyright : (C) 2004 Peter Soetens 00008 email : peter.soetens@mech.kuleuven.ac.be 00009 00010 *************************************************************************** 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU Lesser General Public * 00013 * License as published by the Free Software Foundation; either * 00014 * version 2.1 of the License, or (at your option) any later version. * 00015 * * 00016 * This library is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00019 * Lesser General Public License for more details. * 00020 * * 00021 * You should have received a copy of the GNU Lesser General Public * 00022 * License along with this library; if not, write to the Free Software * 00023 * Foundation, Inc., 59 Temple Place, * 00024 * Suite 330, Boston, MA 02111-1307 USA * 00025 * * 00026 ***************************************************************************/ 00027 00028 #ifndef FAKEENCODER_HPP 00029 #define FAKEENCODER_HPP 00030 00031 #include "rtt/dev/EncoderInterface.hpp" 00032 00033 namespace RTT 00034 { 00038 class FakeEncoder 00039 : public EncoderInterface 00040 { 00041 int turn, pos; 00042 unsigned int mresolution; 00043 bool mupcounting; 00044 public: 00045 FakeEncoder(unsigned int resolution = 4096, bool upcounting = true) 00046 : turn(0), pos(0), 00047 mresolution(resolution), mupcounting(upcounting) 00048 {} 00049 virtual ~FakeEncoder() {} 00050 00054 virtual int positionGet() const { return pos; } 00055 00059 virtual int turnGet() const { return turn; } 00060 00064 virtual void positionSet( int p) { pos = p; } 00065 00069 virtual void turnSet( int t ) { turn = t; } 00070 00076 virtual int resolution() const { return mresolution; } 00077 00084 virtual bool upcounting() const { return mupcounting; } 00085 }; 00086 } 00087 00088 #endif