Dependencies: Farbsensor IRSensorLib PID_Control Servo mbed PixyLib
Fahren.h@9:b83994ef4b08, 2017-05-19 (annotated)
- Committer:
- ZHAW_Prometheus
- Date:
- Fri May 19 12:30:42 2017 +0000
- Revision:
- 9:b83994ef4b08
- Parent:
- 8:077d0bb213a2
- Child:
- 10:10bcb7fee9a6
Vers. 19.05.2017 14:30
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ZHAW_Prometheus | 0:422088ad7fc5 | 1 | #ifndef FAHREN_H |
ZHAW_Prometheus | 0:422088ad7fc5 | 2 | #define FAHREN_H |
ZHAW_Prometheus | 0:422088ad7fc5 | 3 | |
ZHAW_Prometheus | 7:5949f408b6da | 4 | |
ZHAW_Prometheus | 0:422088ad7fc5 | 5 | #include <mbed.h> |
ZHAW_Prometheus | 0:422088ad7fc5 | 6 | #include <cstdlib> |
ZHAW_Prometheus | 0:422088ad7fc5 | 7 | #include "IRSensor.h" |
ZHAW_Prometheus | 8:077d0bb213a2 | 8 | //#include "CamAusw.h" |
ZHAW_Prometheus | 8:077d0bb213a2 | 9 | #include "Pixy.h" |
ZHAW_Prometheus | 8:077d0bb213a2 | 10 | #include "PID_Control.h" |
ZHAW_Prometheus | 0:422088ad7fc5 | 11 | |
ZHAW_Prometheus | 0:422088ad7fc5 | 12 | class Fahren |
ZHAW_Prometheus | 0:422088ad7fc5 | 13 | { |
ZHAW_Prometheus | 0:422088ad7fc5 | 14 | public: |
ZHAW_Prometheus | 0:422088ad7fc5 | 15 | |
ZHAW_Prometheus | 0:422088ad7fc5 | 16 | //Konstruktoren und Destruktoren |
ZHAW_Prometheus | 9:b83994ef4b08 | 17 | Fahren(DigitalOut* enable, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, AnalogIn* distance, DigitalOut* enableMotorDriver, PwmOut& pwmLeft, PwmOut& pwmRight, Pixy& pixy, PID_Control& pid); |
ZHAW_Prometheus | 0:422088ad7fc5 | 18 | Fahren(); |
ZHAW_Prometheus | 0:422088ad7fc5 | 19 | virtual ~Fahren(); |
ZHAW_Prometheus | 0:422088ad7fc5 | 20 | |
ZHAW_Prometheus | 0:422088ad7fc5 | 21 | //Public Methoden |
ZHAW_Prometheus | 9:b83994ef4b08 | 22 | void init(DigitalOut* enable, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, AnalogIn* distance, DigitalOut* enableMotorDriver); |
ZHAW_Prometheus | 0:422088ad7fc5 | 23 | void setSerialOutput(Serial *pc); |
ZHAW_Prometheus | 0:422088ad7fc5 | 24 | int getState(); |
ZHAW_Prometheus | 0:422088ad7fc5 | 25 | void fahrInit(); |
ZHAW_Prometheus | 0:422088ad7fc5 | 26 | void fahrRutine(); |
ZHAW_Prometheus | 0:422088ad7fc5 | 27 | |
ZHAW_Prometheus | 0:422088ad7fc5 | 28 | private: |
ZHAW_Prometheus | 0:422088ad7fc5 | 29 | //Private Methoden |
ZHAW_Prometheus | 0:422088ad7fc5 | 30 | |
ZHAW_Prometheus | 0:422088ad7fc5 | 31 | |
ZHAW_Prometheus | 0:422088ad7fc5 | 32 | //Private Eigenschaften |
ZHAW_Prometheus | 7:5949f408b6da | 33 | IRSensor sensors[6]; |
ZHAW_Prometheus | 7:5949f408b6da | 34 | DigitalOut* enable; |
ZHAW_Prometheus | 7:5949f408b6da | 35 | DigitalOut* bit0; |
ZHAW_Prometheus | 7:5949f408b6da | 36 | DigitalOut* bit1; |
ZHAW_Prometheus | 7:5949f408b6da | 37 | DigitalOut* bit2; |
ZHAW_Prometheus | 7:5949f408b6da | 38 | AnalogIn* distance; |
ZHAW_Prometheus | 7:5949f408b6da | 39 | DigitalOut* enableMotorDriver; |
ZHAW_Prometheus | 9:b83994ef4b08 | 40 | PwmOut& pwmLeft; |
ZHAW_Prometheus | 9:b83994ef4b08 | 41 | PwmOut& pwmRight; |
ZHAW_Prometheus | 9:b83994ef4b08 | 42 | Pixy& pixy; |
ZHAW_Prometheus | 9:b83994ef4b08 | 43 | PID_Control& pid; |
ZHAW_Prometheus | 0:422088ad7fc5 | 44 | |
ZHAW_Prometheus | 0:422088ad7fc5 | 45 | int state; |
ZHAW_Prometheus | 0:422088ad7fc5 | 46 | enum state {gerade=0,rechts,links,drehen,zurueck,zurueck_l,zurueck_r}; |
ZHAW_Prometheus | 0:422088ad7fc5 | 47 | Serial *pc; |
ZHAW_Prometheus | 8:077d0bb213a2 | 48 | float e; |
ZHAW_Prometheus | 8:077d0bb213a2 | 49 | float diff; |
ZHAW_Prometheus | 9:b83994ef4b08 | 50 | int serialTimer; |
ZHAW_Prometheus | 0:422088ad7fc5 | 51 | //Konstante |
schuema4 | 3:017c85c4b14b | 52 | static const double wenden =0.22; |
ZHAW_Prometheus | 0:422088ad7fc5 | 53 | static const double wand =0.07; |
ZHAW_Prometheus | 0:422088ad7fc5 | 54 | }; |
ZHAW_Prometheus | 0:422088ad7fc5 | 55 | |
ZHAW_Prometheus | 0:422088ad7fc5 | 56 | #endif |