Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Servoloop.h
00001 //========================================================================== 00002 // 00003 // Pixy Pet Robot 00004 // 00005 // Adafruit invests time and resources providing this open source code, 00006 // please support Adafruit and open-source hardware by purchasing 00007 // products from Adafruit! 00008 // 00009 // Written by: Bill Earl for Adafruit Industries 00010 // 00011 //========================================================================== 00012 // begin license header 00013 // 00014 // All Pixy Pet source code is provided under the terms of the 00015 // GNU General Public License v2 (http://www.gnu.org/licenses/gpl-2.0.html). 00016 // 00017 // end license header 00018 // 00019 //========================================================================== 00020 // 00021 // Portions of this code are derived from the Pixy CMUcam5 pantilt example code. 00022 // 00023 //========================================================================== 00024 #ifndef SERVOLOOP_H 00025 #define SERVOLOOP_H 00026 #include <SPI.h> 00027 #include <Pixy.h> 00028 #include <MD25.h> 00029 00030 00031 #define X_CENTER 160L 00032 #define Y_CENTER 100L 00033 #define RCS_MIN_POS 0L 00034 #define RCS_MAX_POS 1000L 00035 #define RCS_CENTER_POS ((RCS_MAX_POS-RCS_MIN_POS)/2) 00036 //--------------------------------------- 00037 // Servo Loop Class 00038 // A Proportional/Derivative feedback 00039 // loop for pan/tilt servo tracking of 00040 // blocks. 00041 // (Based on Pixy CMUcam5 example code) 00042 //--------------------------------------- 00043 class Servoloop 00044 { 00045 public: 00046 Servoloop(int32_t proportionalGain, int32_t derivativeGain); 00047 void update(int32_t error); 00048 int32_t m_pos; 00049 int32_t m_prevError; 00050 int32_t m_proportionalGain; 00051 int32_t m_derivativeGain; 00052 00053 }; 00054 #endif 00055 // End Servo Loop Class 00056 //---------------------------------------
Generated on Tue Jul 12 2022 23:06:10 by
1.7.2