![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
the fish that looks like a jet
Dependencies: ADXL345 ADXL345_I2C IMUfilter ITG3200 mbed Servo
motor_controller.h@10:d9f1037f0cb0, 2014-01-31 (annotated)
- Committer:
- rkk
- Date:
- Fri Jan 31 05:18:19 2014 +0000
- Revision:
- 10:d9f1037f0cb0
- Parent:
- 8:0574a5db1fc4
- Child:
- 11:8ec915eb70f6
still working on driving mode
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sandwich | 0:ff9bc5f69c57 | 1 | #pragma once |
sandwich | 0:ff9bc5f69c57 | 2 | #include "mbed.h" |
rkk | 6:a4d6f3e4bf28 | 3 | #define MATH_PI 3.14159265359 |
rkk | 6:a4d6f3e4bf28 | 4 | #define FREQ_MIN 0.5 //Hz |
sandwich | 7:e005cfaff8d1 | 5 | #define FREQ_MAX 3 //Hz |
sandwich | 7:e005cfaff8d1 | 6 | |
sandwich | 7:e005cfaff8d1 | 7 | float sigm(float input); |
sandwich | 0:ff9bc5f69c57 | 8 | |
sandwich | 0:ff9bc5f69c57 | 9 | class PololuMController |
sandwich | 0:ff9bc5f69c57 | 10 | { |
sandwich | 0:ff9bc5f69c57 | 11 | private: |
sandwich | 0:ff9bc5f69c57 | 12 | PwmOut* pwm; |
sandwich | 0:ff9bc5f69c57 | 13 | DigitalOut* outA; |
sandwich | 0:ff9bc5f69c57 | 14 | DigitalOut* outB; |
sandwich | 0:ff9bc5f69c57 | 15 | float timestamp; |
rkk | 8:0574a5db1fc4 | 16 | |
rkk | 8:0574a5db1fc4 | 17 | //for driving |
rkk | 8:0574a5db1fc4 | 18 | float phi1, ome1,amp1; |
rkk | 10:d9f1037f0cb0 | 19 | bool firstTime; |
rkk | 8:0574a5db1fc4 | 20 | |
sandwich | 0:ff9bc5f69c57 | 21 | public: |
sandwich | 0:ff9bc5f69c57 | 22 | PololuMController(); |
sandwich | 0:ff9bc5f69c57 | 23 | PololuMController(PinName pwmport, PinName A, PinName B); |
sandwich | 0:ff9bc5f69c57 | 24 | ~PololuMController(); |
sandwich | 0:ff9bc5f69c57 | 25 | void setspeed(float speed); //0 to 1 |
sandwich | 0:ff9bc5f69c57 | 26 | void setpolarspeed(float speed); //-1 to 1 |
sandwich | 0:ff9bc5f69c57 | 27 | void reverse(); //only works on non-polar speed |
rkk | 10:d9f1037f0cb0 | 28 | float drive_sinusoidal(float currentTime, float amplitude, float frequency); |
sandwich | 7:e005cfaff8d1 | 29 | void drive_rectangular(float currentTime, float amplitude, float frequency); |
sandwich | 0:ff9bc5f69c57 | 30 | }; |