//
float lmax = max(abs(xff[0]-xfi[0]),abs(xff[1]-xfi[1]));
lmax = max(lmax,abs(xff[2]-xfi[2]));
lmax = max(lmax,abs(xff[3]-xfi[3]));
lmax = max(lmax,abs(xff[4]-xfi[4]));
lmax = max(lmax,abs(xff[5]-xfi[5]));
unsigned long preMil = micros();
double l = 0.0;
vel0 = min(vel0,sqrt(lmax*acc0+0.5*velini*velini+0.5*velfin*velfin));
unsigned long curMil = micros();
unsigned long t = 0;
double tap = vel0/acc0-velini/acc0;
double lap = velini*tap+acc0*tap*tap/2.0;
double lcsp = lmax-(vel0*vel0/2.0/acc0-velfin*velfin/2.0/acc0);
double tcsp = (lcsp-lap)/vel0+tap;
double tfin = vel0/acc0-velfin/acc0+tcsp;
It's a bit confusing. Are you using trapezoidal velocity profile here?
Vini is initial velocity, V0 is constant velocity and Vf is final velocity, it seems that calculation is wrong to me.
It's a bit confusing. Are you using trapezoidal velocity profile here? Vini is initial velocity, V0 is constant velocity and Vf is final velocity, it seems that calculation is wrong to me.