Alle Prinf's auskommentiert

Dependencies:   mbed

Fork of Micromouse by Helvijs Kiselis

Revision:
1:2b5f79285a3e
Child:
2:f898adf2d817
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Motion.h	Thu Apr 19 06:19:43 2018 +0000
@@ -0,0 +1,66 @@
+#ifndef MOTION_H_
+#define MOTION_H_
+
+#include <cstdlib>
+#include <mbed.h>
+#include "EncoderCounter.h"
+#include "Controller.h"
+#include "IRSensor.h"
+
+
+class Motion {
+    
+    public:
+    
+        Motion(Controller& controller, EncoderCounter& counterLeft,
+                EncoderCounter& counterRight, IRSensor& irSensorL,
+                IRSensor& irSensorC, IRSensor& irSensorR, AnalogIn& lineSensor,
+                DigitalOut& enableMotorDriver);
+        
+        virtual ~Motion();
+        void    move();
+        void    moveFast();
+        void    scanMove();
+        void    rotateL();
+        void    rotateR();
+        void    stop();
+        void    rotate180();
+        void    control();
+        void    runTask(int task);
+        int     finish();
+
+    private:
+    
+        static const float LEFT_MID_VAL;
+        static const float RIGHT_MID_VAL;
+        static const float KP;
+        static const float KD;
+        
+        Controller& controller;
+        EncoderCounter& counterLeft;
+        EncoderCounter& counterRight;
+        IRSensor& irSensorL;
+        IRSensor& irSensorC;
+        IRSensor& irSensorR;
+        AnalogIn& lineSensor;
+        DigitalOut& enableMotorDriver;
+        
+        float distanceL;
+        float distanceC;
+        float distanceR;
+        short countsL;
+        short countsR;
+        short countsLOld;
+        short countsROld;
+        float speedLeft;
+        float speedRight;
+        float errorP;
+        float errorD;
+        float oldErrorP;
+        float totalError;
+        int waitStop;
+        int task;
+        int line;
+    };
+    
+#endif /* MOTION_H_ */
\ No newline at end of file