amiro-os / include / amiro / MotorIncrements.h @ 81b48c66
History | View | Annotate | Download (1.025 KB)
| 1 | 
      #ifndef AMIRO_MOTOR_INCREMENTS_H_
     | 
  
|---|---|
| 2 | 
      #define AMIRO_MOTOR_INCREMENTS_H_
     | 
  
| 3 | 
       | 
  
| 4 | 
      namespace amiro {
     | 
  
| 5 | 
       | 
  
| 6 | 
        class MotorIncrements {
     | 
  
| 7 | 
       | 
  
| 8 | 
          public:
     | 
  
| 9 | 
          /**
     | 
  
| 10 | 
           * Constructor
     | 
  
| 11 | 
           * This only creates the config. To start the qei driver, one needs to call
     | 
  
| 12 | 
           * qeiInit() after halInit() in the main process first. Then run this->start().
     | 
  
| 13 | 
           *
     | 
  
| 14 | 
           * @param qei0 quadrature encoder for left wheel from 'amiro-os/hal/include/qei.h'
     | 
  
| 15 | 
           * @param qei0 quadrature encoder for right wheel from 'amiro-os/hal/include/qei.h'
     | 
  
| 16 | 
           */
     | 
  
| 17 | 
      MotorIncrements(QEIDriver* qei0, QEIDriver* qei1);  | 
  
| 18 | 
       | 
  
| 19 | 
          /**
     | 
  
| 20 | 
           * Get the encoder position
     | 
  
| 21 | 
           *
     | 
  
| 22 | 
           * @return position of the encode
     | 
  
| 23 | 
           */
     | 
  
| 24 | 
      int qeiGetPosition(int idxQei);  | 
  
| 25 | 
       | 
  
| 26 | 
          /**
     | 
  
| 27 | 
           * Get the range of the qei config
     | 
  
| 28 | 
           *
     | 
  
| 29 | 
           * @return value of the range of the qei
     | 
  
| 30 | 
           */
     | 
  
| 31 | 
          int getQeiConfigRange();
     | 
  
| 32 | 
       | 
  
| 33 | 
          /**
     | 
  
| 34 | 
           * Starts the qei driver (First run qeiInit() in the main process)
     | 
  
| 35 | 
           */
     | 
  
| 36 | 
          void start();
     | 
  
| 37 | 
       | 
  
| 38 | 
        private:
     | 
  
| 39 | 
          QEIDriver* qeiDriver[2];
     | 
  
| 40 | 
      QEIConfig qeiConfig;  | 
  
| 41 | 
      };  | 
  
| 42 | 
       | 
  
| 43 | 
      }  | 
  
| 44 | 
       | 
  
| 45 | 
      #endif /* AMIRO_MOTOR_INCREMENTS_H_ */  |