Eimantas Bernotavicius / Mbed 2 deprecated Buggy_Project

Dependencies:   QEI mbed

Revision:
0:62e51b80d738
Child:
1:12f18cede014
diff -r 000000000000 -r 62e51b80d738 encoderBase.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/encoderBase.cpp	Thu Feb 15 13:19:37 2018 +0000
@@ -0,0 +1,80 @@
+#include "mbed.h"
+#include "QEI.h"
+#include "pins.cpp"
+#define ENCODER_PULSE 256 //per manual
+#define GEAR_RATIO 
+#define SAMPLE_TIME //user defined
+#define WHEEL_DISTANCE //need to measure that
+
+//these lines setup the encoders for both wheels
+QEI encoderRight(channelARight, channelBRight, channelIRight, ENCODER_PULSE);
+QEI encoderLeft(channelALeft, channelBLeft, channelILeft, ENCODER_PULSE);
+
+//main wheel class, the subclasses should follow later
+class Wheel{
+    int currentPulses, previousPulses;
+    public:
+        float wheelVelocity(float, int){
+        }
+    private:
+        float sampleTime= SAMPLE_TIME
+        int gearRatio = GEAR_RATIO;
+        float encoderVelocity(){
+        return (currentEncoderTicks-previousEncoderTicks)/sampleTime;
+        }
+        int encoderTicks(){
+            previousEncoderTicks=currentEncoderTicks;
+            currentEncoderTicks=
+        }
+} wheelRight, wheelLeft;
+
+class WheelLeft
+
+//call this for speed, linear and angular
+class Buggy{
+    public:
+        float speedLinear(float wheelVelocityRight, float wheelVelocityLeft){
+            return (wheelVelocityRight+wheelVelocityLeft)/2;
+            }
+        float speedAngular(float wheelVelocityRight, float wheelVelocityLeft){
+            return (wheelVelocityRight-wheelVelocityLeft)/WHEEL_DISTANCE;
+            }
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+class Buggy{
+    float speed =
+    float angular =
+}buggy;