ti bisogna il phaserunner

Dependencies:   mbed PID mbed-rtos

Committer:
EpicG10
Date:
Thu May 16 20:42:39 2019 +0000
Revision:
7:15e6fc689368
Child:
8:1655d27152e6
Implementation Regler (not finished)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
EpicG10 7:15e6fc689368 1 /**
EpicG10 7:15e6fc689368 2 * Steuert die 4 Phaserunner
EpicG10 7:15e6fc689368 3 */
EpicG10 7:15e6fc689368 4
EpicG10 7:15e6fc689368 5 #ifndef PA_REGLER_H
EpicG10 7:15e6fc689368 6 #define PA_REGLER_H
EpicG10 7:15e6fc689368 7
EpicG10 7:15e6fc689368 8 #include "Phaserunner.h"
EpicG10 7:15e6fc689368 9 #include "Encoder.h"
EpicG10 7:15e6fc689368 10
EpicG10 7:15e6fc689368 11 class Regler{
EpicG10 7:15e6fc689368 12 private:
EpicG10 7:15e6fc689368 13 //Alle Phaserunner
EpicG10 7:15e6fc689368 14 Phaserunner& vorderrad;
EpicG10 7:15e6fc689368 15 Phaserunner& hinterrad;
EpicG10 7:15e6fc689368 16 Phaserunner& linkspedal;
EpicG10 7:15e6fc689368 17 Phaserunner& rechtspedal;
EpicG10 7:15e6fc689368 18
EpicG10 7:15e6fc689368 19 //Encoder
EpicG10 7:15e6fc689368 20 Encoder& encoder;
EpicG10 7:15e6fc689368 21
EpicG10 7:15e6fc689368 22 //Drehmomentverhältnis
EpicG10 7:15e6fc689368 23 uint8_t torqueRatio;
EpicG10 7:15e6fc689368 24
EpicG10 7:15e6fc689368 25 //Verhältnis des Gegenmomentes
EpicG10 7:15e6fc689368 26 uint8_t recupRatio;
EpicG10 7:15e6fc689368 27
EpicG10 7:15e6fc689368 28 //Zeitliche Berechnung der Werte
EpicG10 7:15e6fc689368 29 void ReglerCalculate();
EpicG10 7:15e6fc689368 30
EpicG10 7:15e6fc689368 31 // Ticker
EpicG10 7:15e6fc689368 32 Ticker ticker;
EpicG10 7:15e6fc689368 33
EpicG10 7:15e6fc689368 34 const static float PI = 3.14159265;
EpicG10 7:15e6fc689368 35
EpicG10 7:15e6fc689368 36
EpicG10 7:15e6fc689368 37 public:
EpicG10 7:15e6fc689368 38 /**
EpicG10 7:15e6fc689368 39 * Erstellt einen Regler für alle Phaserunner
EpicG10 7:15e6fc689368 40 * @param vorderrad
EpicG10 7:15e6fc689368 41 * @param hinterrad
EpicG10 7:15e6fc689368 42 * @param linkspedal
EpicG10 7:15e6fc689368 43 * @param rechtspedal
EpicG10 7:15e6fc689368 44 * @param encoder
EpicG10 7:15e6fc689368 45 */
EpicG10 7:15e6fc689368 46 Regler(Phaserunner& vorderrad, Phaserunner& hinterrad, Phaserunner& linkspedal, Phaserunner& rechtspedal, Encoder& encoder);
EpicG10 7:15e6fc689368 47
EpicG10 7:15e6fc689368 48 /**
EpicG10 7:15e6fc689368 49 * Regelt die Phaserunner auf eine bestimmte Geschwindigkeit.
EpicG10 7:15e6fc689368 50 * @param speed Geschwindigkeit in km/h
EpicG10 7:15e6fc689368 51 */
EpicG10 7:15e6fc689368 52 void setSpeed(uint8_t speed);
EpicG10 7:15e6fc689368 53
EpicG10 7:15e6fc689368 54 /**
EpicG10 7:15e6fc689368 55 * Setzt das Drehmomentverhältnis zwischen Vorderrad und Hinterrad.
EpicG10 7:15e6fc689368 56 * @param torqueRatio: Drehmoment des Hinterrades in %. Das Drehmoment auf dem Vorderrad ist dann 100% - torqueRatio.
EpicG10 7:15e6fc689368 57 */
EpicG10 7:15e6fc689368 58 void setTorqueProportion(uint8_t torqueRatio);
EpicG10 7:15e6fc689368 59
EpicG10 7:15e6fc689368 60 /**
EpicG10 7:15e6fc689368 61 * Setzt das Verhältnis des Gegenmomentes zwischen Vorderrad und Hinterrad.
EpicG10 7:15e6fc689368 62 * @param torqueRatio: Gegenmoment des Hinterrades in %. Das Gegenmoment auf dem Vorderrad ist dann 100% - torqueRatio.
EpicG10 7:15e6fc689368 63 */
EpicG10 7:15e6fc689368 64 void setRecuperationProportion(uint8_t recupRatio);
EpicG10 7:15e6fc689368 65
EpicG10 7:15e6fc689368 66 /**
EpicG10 7:15e6fc689368 67 * Setzt das Drehmoment auf beide Phaserunner.
EpicG10 7:15e6fc689368 68 * @param torque Drehmoment in Prozent
EpicG10 7:15e6fc689368 69 */
EpicG10 7:15e6fc689368 70 void setTorqueMotors(uint8_t torque);
EpicG10 7:15e6fc689368 71
EpicG10 7:15e6fc689368 72 /**
EpicG10 7:15e6fc689368 73 * Setzt das Drehmoment auf beide Phaserunner.
EpicG10 7:15e6fc689368 74 * @param torque Drehmoment in Prozent
EpicG10 7:15e6fc689368 75 */
EpicG10 7:15e6fc689368 76 void setTorquePedals(uint8_t torque);
EpicG10 7:15e6fc689368 77
EpicG10 7:15e6fc689368 78 /**
EpicG10 7:15e6fc689368 79 * Setzt die Rekuperation der Motoren
EpicG10 7:15e6fc689368 80 * @param recuperation
EpicG10 7:15e6fc689368 81 */
EpicG10 7:15e6fc689368 82 void setRecuperationMotors(uint8_t recuperation);
EpicG10 7:15e6fc689368 83
EpicG10 7:15e6fc689368 84 /**
EpicG10 7:15e6fc689368 85 * Setzt die Rekuperation der Pedale
EpicG10 7:15e6fc689368 86 * @param recuperation
EpicG10 7:15e6fc689368 87 */
EpicG10 7:15e6fc689368 88 void setRecuperationPedals(uint8_t recuperation);
EpicG10 7:15e6fc689368 89 };
EpicG10 7:15e6fc689368 90
EpicG10 7:15e6fc689368 91 #endif //PA_REGLER_H
EpicG10 7:15e6fc689368 92