Marco Rubio
/
RTOS_Controller
Controller for Seagoat in the RoboSub competition
Fork of ESC by
main.cpp@5:07bbe020eb65, 2016-07-26 (annotated)
- Committer:
- gelmes
- Date:
- Tue Jul 26 17:22:33 2016 +0000
- Revision:
- 5:07bbe020eb65
- Parent:
- 4:b37fd183e46a
This is a working implementation of the Controller;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gelmes | 3:5ffe7e9c0bb3 | 1 | // Continuously sweep the servo through it's full range |
gelmes | 3:5ffe7e9c0bb3 | 2 | #include "mbed.h" |
gelmes | 3:5ffe7e9c0bb3 | 3 | #include "vessel.h" |
gelmes | 3:5ffe7e9c0bb3 | 4 | |
gelmes | 3:5ffe7e9c0bb3 | 5 | int main() |
gelmes | 3:5ffe7e9c0bb3 | 6 | { |
gelmes | 5:07bbe020eb65 | 7 | Timer t; |
gelmes | 5:07bbe020eb65 | 8 | |
gelmes | 5:07bbe020eb65 | 9 | wait(3); |
gelmes | 3:5ffe7e9c0bb3 | 10 | Vessel seagoat; //Starts the seagoat |
gelmes | 5:07bbe020eb65 | 11 | seagoat.SetYawPID(4,0,0); |
gelmes | 5:07bbe020eb65 | 12 | seagoat.SetRollPID(4,0,0); |
gelmes | 5:07bbe020eb65 | 13 | seagoat.SetPitchPID(4,0,0); |
gelmes | 5:07bbe020eb65 | 14 | seagoat.SetXPID(0,0,0); |
gelmes | 5:07bbe020eb65 | 15 | seagoat.SetYPID(0,0,0); |
gelmes | 5:07bbe020eb65 | 16 | seagoat.SetZPID(0,0,0); |
gelmes | 5:07bbe020eb65 | 17 | |
gelmes | 5:07bbe020eb65 | 18 | t.start(); |
gelmes | 5:07bbe020eb65 | 19 | while(t.read() < 5){ |
gelmes | 5:07bbe020eb65 | 20 | seagoat.calibrate(); |
gelmes | 5:07bbe020eb65 | 21 | |
gelmes | 5:07bbe020eb65 | 22 | //pc.printf("%f \n", t.read()); |
gelmes | 5:07bbe020eb65 | 23 | } |
gelmes | 5:07bbe020eb65 | 24 | t.stop(); |
gelmes | 5:07bbe020eb65 | 25 | pc.printf("Seagoat Ready to Go\n\r"); |
gelmes | 5:07bbe020eb65 | 26 | //seagoat.motorTest(); |
gelmes | 3:5ffe7e9c0bb3 | 27 | |
gelmes | 4:b37fd183e46a | 28 | while(1) { |
gelmes | 5:07bbe020eb65 | 29 | |
gelmes | 5:07bbe020eb65 | 30 | //seagoat.motorTest(); |
gelmes | 4:b37fd183e46a | 31 | seagoat.update(); |
gelmes | 5:07bbe020eb65 | 32 | |
gelmes | 5:07bbe020eb65 | 33 | wait(0.01); |
gelmes | 4:b37fd183e46a | 34 | } |
gelmes | 3:5ffe7e9c0bb3 | 35 | } |