Code: #pragma config(Sensor, in1, IR, sensorPotentiometer) #pragma config(Sensor, in3, rot_Lt, sensorQuadEncoder, int5) #pragma config(Sensor, in2, rot_Rt, sensorQuadEncoder, int3) #pragma config(Sensor, in4, b_oscIRLim, sensorTouch) #pragma config(Motor, port1, m_IR, tmotorNormal, openLoop) #pragma config(Motor, port7, m_Rt, tmotorNormal, openLoop) #pragma config(Motor, port8, m_Lt, tmotorNormal, openLoop, reversed)
int PID_SC = 112;//Speed Constant (accounts for wheel diameter and gearing) int PID_AC = 5;//Angle Constant (accounts for wheel diameter and gearing) int PID_sKP = 2; //P-Constant (Acceleration) int PID_sKI = 1;// Integral Constant Rate of compounding error correction int PID_sKD =12;// Derivative Constant int PID_hKP = 15; //P-Constant (Acceleration) int PID_hKI = 28;// Integral Constant Rate of compounding error correction int PID_hKD =3;// Derivative Constant int PID_TSpd = 0;//Target Speed/distance int PID_THead = 0;//Target heading int PID_MaxHAdj = 20; //max turn rate bool PID_HAdj = false; //are we sending a relative heading adjustment? bool PID_EMG = false; // signal an emergancy stop; int PID_spd; // current speed in ~mm/s int PID_hdg=0; //current heading rel. to origin int PID_dist=0; //distance travelled int Espd,Ehead;
const int OIR_SENSE[11] = {800,350,275,200,150,120,105,93,88,75,70}; const int OIR_TIMING[7] = {200, 40, 50, 60, 70, 20, 30}; int OIR_RAW[7] = {0,0,0,0,0,0,0};
//int CRUISE_Risk[5] 1<--when I add this last array it crashes int OIR_CT1=0; int OIR_CT1EP=0; |