My modifications/additions to the code
Dependencies: ADXL345 ADXL345_I2C IMUfilter ITG3200 Servo fishgait mbed-rtos mbed pixy_cam
Fork of robotic_fish_ver_4_8 by
Diff: servoloop.h
- Revision:
- 25:4f2f441eceec
diff -r 9d75ed1462d6 -r 4f2f441eceec servoloop.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/servoloop.h Fri Jul 11 14:30:36 2014 +0000 @@ -0,0 +1,20 @@ +#pragma once +#include "mbed.h" +//class to aid with vision feedback +//taken from +// https://github.com/charmedlabs/pixy/blob/master/arduino/libraries/Pixy/examples/pantilt/pantilt.ino +#define RCS_MIN_POS 0L +#define RCS_MAX_POS 1000L +#define RCS_CENTER_POS ((RCS_MAX_POS-RCS_MIN_POS)/2) +class ServoLoop +{ +public: + ServoLoop(int32_t pgain, int32_t dgain); + + void update(int32_t error); + + int32_t m_pos; + int32_t m_prevError; + int32_t m_pgain; + int32_t m_dgain; +}; \ No newline at end of file