• Main Page
  • Classes
  • Files
  • File List
  • File Members

qemotorrec.h

Go to the documentation of this file.
00001 //
00002 // begin license header
00003 //  
00004 // This file is part of Terk and TerkOS.
00005 //
00006 // All Terk and TerkOS source code is provided under the terms of the 
00007 // GNU General Public License v2 (http://www.gnu.org/licenses/gpl-2.0.html).  
00008 // Those wishing to use Terk and TerkOS source code, software and/or
00009 // technologies under different licensing terms should contact us at 
00010 // [email protected]. Such licensing terms are available for
00011 // all portions of the Terk and TerkOS codebase presented here.
00012 //
00013 // end license header
00014 //
00015 
00016 #ifndef _QEMOTORREC_H
00017 #define _QEMOTORREC_H
00018 
00019 #include <pthread.h>
00020 #include "qemotor.h"
00021 
00022 enum ERBState
00023   {
00024     STATE_STANDBY,
00025     STATE_TRANSITION_RECORD,
00026     STATE_RECORD,
00027     STATE_TRANSITION_PLAY,
00028     STATE_PLAY
00029   };
00030 
00035 class CQEMotorRec 
00036 {
00037 public:
00038   CQEMotorRec(unsigned long size=0, unsigned char axes=0, pthread_mutex_t *pMutex=NULL);
00039   virtual ~CQEMotorRec();
00040 
00041   void Init(unsigned long size, unsigned char axes, pthread_mutex_t *pMutex);
00042 
00049   virtual void Record();
00050 
00055   virtual void Play();
00056 
00060   void RStop();
00061 
00066   bool Playing();
00067 
00072   bool Recording();
00073 
00074 protected:
00075   bool UpdatePosition(); // returns true if RecordUpdate needs updated position
00076 
00077   short *m_pdata;
00078   unsigned long m_readIndex;
00079   unsigned long m_writeIndex;
00080   unsigned long m_size;
00081   unsigned char m_axes;
00082 
00083 
00084   bool RecordActive();
00085   bool RecordServo();
00086   void RecordUpdate(Axis_position position[], Axis_position desiredPosition[]);
00087   short *SetPlay();
00088   short *GetRecord();
00089 
00090   Axis_position m_recIntegral[QEMOT_NUM_MOTORS];
00091   ERBState m_state;
00092   bool m_servo;
00093 
00094   pthread_mutex_t *m_pMutex;
00095 };
00096 
00097 
00098 #endif

Generated on Mon Oct 3 2011 15:36:31 for libqwerk by  doxygen 1.7.1