Updated with the Algorithm

Dependencies:   QEI mbed

Fork of MM_rat_Assignment4-newwest by Evan Brown

Committer:
Showboo
Date:
Fri Dec 08 05:14:27 2017 +0000
Revision:
9:97941581fe81
Parent:
8:22e399fe87a4
Ready for Competition

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Showboo 8:22e399fe87a4 1 #ifndef CONSTANTS_H
Showboo 8:22e399fe87a4 2 #define CONSTANTS_H
Showboo 8:22e399fe87a4 3 namespace constants{
Showboo 8:22e399fe87a4 4 const int cell_length = 130;
Showboo 8:22e399fe87a4 5 float leftValue;
Showboo 8:22e399fe87a4 6 float rightValue;
Showboo 8:22e399fe87a4 7 float leftFrontValue;
Showboo 8:22e399fe87a4 8 float rightFrontValue;
Showboo 8:22e399fe87a4 9 //Errors for all the IR Readings that are used in PID later below.
Showboo 8:22e399fe87a4 10 float leftError = 0;
Showboo 8:22e399fe87a4 11 float rightError = 0;
Showboo 8:22e399fe87a4 12 float prevrightError = 0;
Showboo 8:22e399fe87a4 13 float prevleftError = 0;
Showboo 8:22e399fe87a4 14 float prevLeftFrontValue= 0;
Showboo 8:22e399fe87a4 15 float prevRightFrontValue = 0;
Showboo 8:22e399fe87a4 16 float changeLeftFrontValue = 0;
Showboo 8:22e399fe87a4 17 float changeRightFrontValue = 0;
Showboo 8:22e399fe87a4 18 float totalFrontChange = 0;
Showboo 8:22e399fe87a4 19 float leftFrontError = 0;
Showboo 8:22e399fe87a4 20 float rightFrontError = 0;
Showboo 8:22e399fe87a4 21 float totalLeftError = 0;
Showboo 8:22e399fe87a4 22 float totalRightError =0;
Showboo 8:22e399fe87a4 23 //Adjustment values that are set for the PID from the IR Sensors.
Showboo 8:22e399fe87a4 24 float adjust_l = 0;
Showboo 8:22e399fe87a4 25 float adjust_r = 0;
Showboo 8:22e399fe87a4 26 float leftIRBase;
Showboo 8:22e399fe87a4 27 float rightIRBase;
Showboo 8:22e399fe87a4 28 float leftFrontIRBase;
Showboo 8:22e399fe87a4 29 float rightFrontIRBase;
Showboo 8:22e399fe87a4 30 //PID For the IR Sensors.
Showboo 9:97941581fe81 31 float p = 0.4f; //.32
Showboo 8:22e399fe87a4 32 float i = 0.0001f;
Showboo 9:97941581fe81 33 float d = 0.17f;
Showboo 9:97941581fe81 34 float frontP = 3.0;
Showboo 8:22e399fe87a4 35 };
Showboo 8:22e399fe87a4 36 #endif