Dependencies:   mbed CANMsg



File content as of revision 4:d32258ec411f:

// define constants
const double Pi = 3.141592654f;

// define logic UI variables which NEED TO BE SET FROM UI
// *** speed wheel
double speedWheelDiameter = 0.300f;     // variable for tractor speed calculation (need to be set from UI) ( Unit= meters )
double speedWheelPulse = 18.0f;          // variable which define the number of pulse each turn of tractor speed wheel (need to be set from UI)
// *** seeding wheel
double seedWheelDiameter = 0.75f;      // seed wheel diameter setting
double seedWheelMotorSteps = 3200.0f;    // seed wheel motor steps without reduction (defined from driver)
double seedWheelRPM=0.0f;               // number of turn per minute of seed wheel
double seedWhellFrequency=0.0f;         // seed wheel frequency which is function of tractor speed
//double seedWheelPeriodTeory=0.0f;
double seedWheelPeriod=0.0f;            // seed wheel pulse period

double deepOfSeed=0.00f;                // deep of seeding 
double oldSeedWheelPeriod=0.0f;
double pickNumber = 12.0f;               // numero di becchi installati sulla ruota di semina
double cellsNumber = 15.0f;             // numero di celle del tamburo

double TBmotorSteps = 1600.0f;           // TB wheel motor steps without reduction (defined from driver)
double TBreductionRatio = 1.65625f;      // TB mechanical reduction ratio 
double SDreductionRatio =2.5714f;        // seed wheel machanical reduction ratio
double TBdeltaStep = 0.0f;            // steps of advance for manage tb motor respect sd motor
double K_WheelRPM =0.0f;
double K_WhellFrequency=0.0f;
double K_TBfrequency = 0.0f;
double K_percentuale = 0.0f;
double timeIntraPick = 0.0f;
double teoryTimeIntraPick = 0.0f;
double intraPickDistance = 0.0f;

uint8_t quinconceActive=1;

uint16_t periodoSD = 1000;
double dcStopDuty = 0.0f;
double dcMinDuty = 0.0f;     // definisce il duty cycle minimo alla partenza (corrisponde alla tensione minima di rotazione)
double dcMaxDuty = 1.0f;     // definisce il duty cycle al massimo della velocità
double dcMinSpeed = 0.65f;
double dcMaxSpeed = 1.00f;
double dcStarting = 0.30f;
double fixedStepGiroSD = 9000.0f;                                  // numero di suddivisioni angolo giro della ruota di semina
double minWorkSpeed=0.138888f;  //metri al secondo pari a 0,5Kmh
double maxWorkSpeed=1.277777f;  //metri al secondo pari a 4.6Kmh
double tabComan[22]={0.25,0.255,0.260,0.265,0.27,0.28,0.3107,0.314,0.34,0.3655,0.391,0.4165,0.4335,0.459,0.51,0.5525,0.595};
double tabSpeed[22]={0.10,0.14,0.19,0.22,0.25,0.28,0.33,0.36,0.41,0.45,0.49,0.55,0.59,0.62,0.75,0.80,0.82};

double minPosSpeed=0.20f;   // metri/secondo (0,20 = 0,72KmH)
double minSeedSpeed=0.22f;  // attiva il LowSpeed mt/s (0,28 = 1,0KmH)
double speedForCorrection=0.25f;
int cicliAspettaStart = 2;
double arcoHole= 0.031186f;  // in metri
double arcoBecco = 0.0581f;
double avvioGradi=5.0f;
double anticipoMax = 0.0f;
double angoloFase = 7.0f;