Prom_Roebi_0.1

Dependencies:   Farbsensor IRSensorLib PID_Control Servo mbed PixyLib

Committer:
ZHAW_Prometheus
Date:
Fri May 26 09:11:49 2017 +0000
Revision:
16:ad45ef4fee04
Parent:
15:26dbcd6ff48d
Vers. 26.05.2017 11:10

Who changed what in which revision?

UserRevisionLine numberNew 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 0:422088ad7fc5 4 #include <mbed.h>
ZHAW_Prometheus 0:422088ad7fc5 5 #include <cstdlib>
ZHAW_Prometheus 0:422088ad7fc5 6 #include "IRSensor.h"
ZHAW_Prometheus 8:077d0bb213a2 7 //#include "CamAusw.h"
ZHAW_Prometheus 8:077d0bb213a2 8 #include "Pixy.h"
ZHAW_Prometheus 8:077d0bb213a2 9 #include "PID_Control.h"
ZHAW_Prometheus 0:422088ad7fc5 10
ZHAW_Prometheus 0:422088ad7fc5 11 class Fahren
ZHAW_Prometheus 0:422088ad7fc5 12 {
ZHAW_Prometheus 0:422088ad7fc5 13 public:
ZHAW_Prometheus 0:422088ad7fc5 14 //Konstruktoren und Destruktoren
ZHAW_Prometheus 15:26dbcd6ff48d 15 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 16 Fahren();
ZHAW_Prometheus 0:422088ad7fc5 17 virtual ~Fahren();
ZHAW_Prometheus 0:422088ad7fc5 18
ZHAW_Prometheus 0:422088ad7fc5 19 //Public Methoden
ZHAW_Prometheus 0:422088ad7fc5 20 void setSerialOutput(Serial *pc);
ZHAW_Prometheus 12:472b26872a42 21 void printState();
ZHAW_Prometheus 0:422088ad7fc5 22 void fahrInit();
ZHAW_Prometheus 0:422088ad7fc5 23 void fahrRutine();
ZHAW_Prometheus 0:422088ad7fc5 24
ZHAW_Prometheus 0:422088ad7fc5 25 private:
ZHAW_Prometheus 14:bee8101aad45 26 /**
ZHAW_Prometheus 14:bee8101aad45 27 * Private Methoden
ZHAW_Prometheus 14:bee8101aad45 28 */
ZHAW_Prometheus 0:422088ad7fc5 29
ZHAW_Prometheus 14:bee8101aad45 30 /**
ZHAW_Prometheus 14:bee8101aad45 31 * Private Eigenschaften
ZHAW_Prometheus 14:bee8101aad45 32 */
ZHAW_Prometheus 14:bee8101aad45 33 //Digitale, Analoge und Serielle In/Outputs
ZHAW_Prometheus 7:5949f408b6da 34 IRSensor sensors[6];
ZHAW_Prometheus 12:472b26872a42 35 DigitalOut& enable;
ZHAW_Prometheus 12:472b26872a42 36 DigitalOut& bit0;
ZHAW_Prometheus 12:472b26872a42 37 DigitalOut& bit1;
ZHAW_Prometheus 12:472b26872a42 38 DigitalOut& bit2;
ZHAW_Prometheus 12:472b26872a42 39 AnalogIn& distance;
ZHAW_Prometheus 12:472b26872a42 40 DigitalOut& enableMotorDriver;
ZHAW_Prometheus 9:b83994ef4b08 41 PwmOut& pwmLeft;
ZHAW_Prometheus 9:b83994ef4b08 42 PwmOut& pwmRight;
ZHAW_Prometheus 9:b83994ef4b08 43 Pixy& pixy;
ZHAW_Prometheus 9:b83994ef4b08 44 PID_Control& pid;
ZHAW_Prometheus 14:bee8101aad45 45 //Variabeln
ZHAW_Prometheus 14:bee8101aad45 46 uint8_t state;
ZHAW_Prometheus 15:26dbcd6ff48d 47 uint8_t searchTimer;
ZHAW_Prometheus 16:ad45ef4fee04 48 uint8_t zurTimer;
ZHAW_Prometheus 15:26dbcd6ff48d 49 enum state {gerade=0, cam, rechts, links, drehen_ran, drehen_r, drehen_l, zurueck, zurueck_l, zurueck_r, hart_zurueck_r, hart_zurueck_l, camSearchRot, camSearchDrive};
ZHAW_Prometheus 12:472b26872a42 50 Serial *pc;
ZHAW_Prometheus 12:472b26872a42 51 float e;
ZHAW_Prometheus 12:472b26872a42 52 float diff;
ZHAW_Prometheus 15:26dbcd6ff48d 53 float s0, s1, s2, s3, s4, s5;
ZHAW_Prometheus 0:422088ad7fc5 54 //Konstante
schuema4 3:017c85c4b14b 55 static const double wenden =0.22;
ZHAW_Prometheus 0:422088ad7fc5 56 static const double wand =0.07;
ZHAW_Prometheus 0:422088ad7fc5 57 };
ZHAW_Prometheus 0:422088ad7fc5 58
ZHAW_Prometheus 14:bee8101aad45 59 #endif