Majordhome/pixy
Servoloop.h
- Committer:
- johnylafleur
- Date:
- 2015-04-14
- Revision:
- 1:7915442d0bd8
- Parent:
- 0:b12a5af91608
File content as of revision 1:7915442d0bd8:
//========================================================================== // // Pixy Pet Robot // // Adafruit invests time and resources providing this open source code, // please support Adafruit and open-source hardware by purchasing // products from Adafruit! // // Written by: Bill Earl for Adafruit Industries // //========================================================================== // begin license header // // All Pixy Pet source code is provided under the terms of the // GNU General Public License v2 (http://www.gnu.org/licenses/gpl-2.0.html). // // end license header // //========================================================================== // // Portions of this code are derived from the Pixy CMUcam5 pantilt example code. // //========================================================================== #ifndef SERVOLOOP_H #define SERVOLOOP_H #include <SPI.h> #include <Pixy.h> #include <MD25.h> #define X_CENTER 160L #define Y_CENTER 100L #define RCS_MIN_POS 0L #define RCS_MAX_POS 1000L #define RCS_CENTER_POS ((RCS_MAX_POS-RCS_MIN_POS)/2) //--------------------------------------- // Servo Loop Class // A Proportional/Derivative feedback // loop for pan/tilt servo tracking of // blocks. // (Based on Pixy CMUcam5 example code) //--------------------------------------- class Servoloop { public: Servoloop(int32_t proportionalGain, int32_t derivativeGain); void update(int32_t error); int32_t m_pos; int32_t m_prevError; int32_t m_proportionalGain; int32_t m_derivativeGain; }; #endif // End Servo Loop Class //---------------------------------------