Implement new controller

Dependencies:   mbed-rtos mbed QEI BNO055 MPU6050_DMP_Nucleo-I2Cdev virgo3_imuHandler_Orion_PCB MAX17048 Servo

Fork of Orion_newPCB_test by Team Virgo v3

Committer:
ahmed_lv
Date:
Tue Mar 20 05:56:22 2018 +0000
Revision:
30:44676e1b38f8
Parent:
23:6806c3bacf58
Editted Input Variables to PID

Who changed what in which revision?

UserRevisionLine numberNew contents of line
akashvibhute 11:49344285c82a 1 #ifndef odometer_H
akashvibhute 11:49344285c82a 2 #define odometer_H
akashvibhute 11:49344285c82a 3
akashvibhute 11:49344285c82a 4 #include "mbed.h"
akashvibhute 11:49344285c82a 5 #include "generalFunctions.h"
akashvibhute 11:49344285c82a 6 #include "QEI.h"
akashvibhute 11:49344285c82a 7 #include "config.h"
harrynguyen 23:6806c3bacf58 8 #include "orion_pinmapping.h"
akashvibhute 11:49344285c82a 9
akashvibhute 11:49344285c82a 10
akashvibhute 11:49344285c82a 11 class odometer
akashvibhute 11:49344285c82a 12 {
akashvibhute 11:49344285c82a 13 public:
akashvibhute 11:49344285c82a 14 odometer();
akashvibhute 11:49344285c82a 15 void update();
akashvibhute 11:49344285c82a 16 void init();
akashvibhute 11:49344285c82a 17 //void getRevolutions(float *revolutions[2]);
akashvibhute 11:49344285c82a 18 //void getRPM(float *rpm[2]);
akashvibhute 11:49344285c82a 19
akashvibhute 11:49344285c82a 20 float revolutions[2];
akashvibhute 11:49344285c82a 21 float rpm[2];
akashvibhute 11:49344285c82a 22
akashvibhute 11:49344285c82a 23 private:
akashvibhute 11:49344285c82a 24 QEI encLeft;
akashvibhute 11:49344285c82a 25 QEI encRight;
akashvibhute 11:49344285c82a 26
akashvibhute 11:49344285c82a 27 Timer enc_timer;
akashvibhute 11:49344285c82a 28 float timer_s;
akashvibhute 11:49344285c82a 29
akashvibhute 11:49344285c82a 30 uint16_t movWindow_len;
akashvibhute 11:49344285c82a 31 uint16_t movWindow_index;
akashvibhute 11:49344285c82a 32 float encRes;
akashvibhute 11:49344285c82a 33
akashvibhute 11:49344285c82a 34 static const unsigned int movWindow_lenMax = 64; //to prevent excessive RAM usage at program runtime
akashvibhute 11:49344285c82a 35
akashvibhute 11:49344285c82a 36 int32_t pulse_counter[2][2]; // [0:left / 1:right], [0:previous / 1:current]
akashvibhute 11:49344285c82a 37 float rpmWindow_left[movWindow_lenMax]; // [movWindow_index: instantaneous velocity in rpm]
akashvibhute 11:49344285c82a 38 float rpmWindow_right[movWindow_lenMax]; // [movWindow_index: instantaneous velocity in rpm]
akashvibhute 11:49344285c82a 39
akashvibhute 11:49344285c82a 40 float filtered_reading[2][2]; // [0:left / 1:right], [0:revolutions / 1:velocity in rpm]
akashvibhute 11:49344285c82a 41 };
akashvibhute 11:49344285c82a 42
akashvibhute 11:49344285c82a 43
akashvibhute 11:49344285c82a 44 #endif