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
servoloop.h@25:4f2f441eceec, 2014-07-11 (annotated)
- Committer:
- sandwich
- Date:
- Fri Jul 11 14:30:36 2014 +0000
- Revision:
- 25:4f2f441eceec
latest revision
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sandwich | 25:4f2f441eceec | 1 | #pragma once |
sandwich | 25:4f2f441eceec | 2 | #include "mbed.h" |
sandwich | 25:4f2f441eceec | 3 | //class to aid with vision feedback |
sandwich | 25:4f2f441eceec | 4 | //taken from |
sandwich | 25:4f2f441eceec | 5 | // https://github.com/charmedlabs/pixy/blob/master/arduino/libraries/Pixy/examples/pantilt/pantilt.ino |
sandwich | 25:4f2f441eceec | 6 | #define RCS_MIN_POS 0L |
sandwich | 25:4f2f441eceec | 7 | #define RCS_MAX_POS 1000L |
sandwich | 25:4f2f441eceec | 8 | #define RCS_CENTER_POS ((RCS_MAX_POS-RCS_MIN_POS)/2) |
sandwich | 25:4f2f441eceec | 9 | class ServoLoop |
sandwich | 25:4f2f441eceec | 10 | { |
sandwich | 25:4f2f441eceec | 11 | public: |
sandwich | 25:4f2f441eceec | 12 | ServoLoop(int32_t pgain, int32_t dgain); |
sandwich | 25:4f2f441eceec | 13 | |
sandwich | 25:4f2f441eceec | 14 | void update(int32_t error); |
sandwich | 25:4f2f441eceec | 15 | |
sandwich | 25:4f2f441eceec | 16 | int32_t m_pos; |
sandwich | 25:4f2f441eceec | 17 | int32_t m_prevError; |
sandwich | 25:4f2f441eceec | 18 | int32_t m_pgain; |
sandwich | 25:4f2f441eceec | 19 | int32_t m_dgain; |
sandwich | 25:4f2f441eceec | 20 | }; |