Francesco Pistone
/
Viaro_SpandiConcime_V3_inizio
copia12092018
variables.h
- Committer:
- root@developer-sjc-indigo-compiler.local.mbed.org
- Date:
- 2018-11-16
- Revision:
- 13:4d6114864f2d
- Parent:
- 11:dde73cf20353
File content as of revision 13:4d6114864f2d:
int SD_faultA=0; int SD_faultB=0; int DC_brake=1; int DC_forward=1; float PID_Rate(0.1); string MachineType("electric"); //two options: "electric" or "idraulic" float Percent(1.0); //variable to add/take out a Percent of product with PlusPercentPin/MinusPercentPin char ChangeFromOffToOn(1); //used to reset Previous millis() when the operator switch off and back on char StopTheMotorWeGoTooSlow(1); //stop the motor, we go too slow char MotorSensorError(0); //stop the motor, we go too slow int TrigsPerWheelRevolution(10); //number of triggers per weheel complete revolution int WheelDiameter(400); //wheel diameter in millimeters unsigned long WantedMotorSpeed(0); //motor speed (initial is 0) unsigned long ReadMotorSpeed(0); //motor speed (initial is 0) float MotorSpeedCorrected(0); //motor speed (initial is 0) float MotorSpeedPwmTemp(0); //motor speed pwm (initial is 0) float MotorSpeedPwm(0); //motor speed pwm (initial is 0) int MinMotorPwm(1); //min pwm for the motor to start int MinMotorSpeed(1000); //min motor speed int MaxMotorSpeed(10000); //max motor speed //int WheelToMotorRatio(100); //set the ideal ratio between wheel speed and motor speed //RUOTA FONICA > MOTORE //francesco 17/09/2018 -> test int WheelToMotorRatio(100); // 4 (=pv) * 60(=3000/50) * 12 (differenza circonferenza di rotazione) float MotorCorrection(1.0); //set the initial motor correction factor int MotorSensorSecurityCheck(0); //set the initial motor correction factor float DecelerationControlRatio(1.5); //ratio to control wheel decelaration accepted limit const int ConstArrayIns(3); //the number set the array values CB1<int,ConstArrayIns> ReadWheelArray; //Circular array (for LIFO purposes) for wheel sensor readings CB1<int,ConstArrayIns> ReadMotorArray; //Circular array (for LIFO purposes) for wheel sensor readings int i; //general purpose integer for loops int a; //general purpose integer for loops unsigned long TempReadW; //temporal read of wheel sensor millis for analysis unsigned long TempReadM; //temporal read of motor sensor millis for analysis unsigned long ElapsedW(0); //used to take note of Elapsed time unsigned long ElapsedM(0); //used to take note of Elapsed time unsigned long CheckIfReadMChanges(0); //feedback of motor sensor //from PID library: 0.0 - 1.0 //PID motorPID(0.5, 0.3, 0.1, 0.1); //Kc, Ti, Td, interval (0.1ms) //francesco 13/09/2018 --> test togliendo la parte derivativa del PID //PID motorPID(0.5, 0.3, 0.0, 0.1); //Kc, Ti, Td, interval (0.1ms) PID motorPID(1.0, 1.0, 0.0, 0.1); //Kc, Ti, Td, interval (0.01ms) //the below declarations are meant to prevent problems on switches due to tractor vibrations int VibrationTimer(500); //timer for avoid vibrations in millis bool ChangeStatusOfOnOffPinToHigh(1); bool ChangeStatusOfOnOffPinToLow(1); bool ChangeStatusOfPlusPercentPinToHigh(1); bool ChangeStatusOfPlusPercentPinToLow(1); bool PercentPlus(0); bool ChangeStatusOfMinusPercentPinToHigh(1); bool ChangeStatusOfMinusPercentPinToLow(1); bool PercentMinus(0); bool WheelData(0); //need to tell main() there's some data to handle bool MotorData(0); //need to tell main() there's some data to handle bool Compute(0); bool SecurityStop(0);