I know this has been discussed before, but this variant may be slightly different. I did try running the compiled sine on the PMAC and it worked fine. But when I stream it, I get some horrible velocity blending artifacts (jumping motion due to oscillating velcoity, when it should be smooth). I'm no sure how to fix this.
I am trying to stream a motion trajectory to the Geobrick. It seems to work in spline mode, but PVT mode I get some instability/judder. As far as I can tell this sine command is ok, but not sure why I get the behavior I see in the plot. Is there anything obvious?
DEVLOCATIONTYPE location2;
pmac.GetPmacLocation(dwDevice,(long *)&location2);
// Define a rotary buffer
pmac.GetResponseEx(dwDevice,_T("&1 DEF ROT 2500 B0"),0,&szTest1,&status);
// Clear the DPRAM rotary buffer
pmac.DPRRotBufClr(dwDevice,coordSys);
// Clear the PMAC internal rotary buffer
pmac.GetResponseEx(dwDevice,_T("&1 OPEN ROT CLR CLS"),FALSE,&szTest1,&status);
// Turn the Rotary buffer transfer on
pmac.DPRSetRotBuf(dwDevice,TRUE);
double pi = 3.1416;
const double T = 5;
const double A = 10;
const double u = (2*pi/T);
const double C = 2;
const double phi0 = pi / 2;
double delta_t = 100e-3;
pmac.DPRAsciiStrToRotEx(dwDevice,_T("ABS"),coordSys,TRUE,&status);
pmac.DPRAsciiStrToRotEx(dwDevice,_T("LINEAR"),coordSys,TRUE,&status);
pmac.DPRAsciiStrToRotEx(dwDevice,_T("X 0"),coordSys,TRUE,&status);
pmac.DPRAsciiStrToRotEx(dwDevice,_T("DWELL 0"),coordSys,TRUE,&status);
pmac.DPRAsciiStrToRotEx(dwDevice,_T("PVT100"),coordSys,TRUE,&status);
pmac.DPRAsciiStrToRotEx(dwDevice,_T("BLOCKSTART"),coordSys,TRUE,&status);
CString command;
for(double t = 0.0; t < 5; t += delta_t)
{
const double p = A * sin( u* t - phi0) + A ;
const double v = A * u * cos(u * t - phi0) ;
command.Format("X %0.7f:%0.7f\n",p,v);
pmac.DPRAsciiStrToRotEx(dwDevice,command,coordSys,TRUE,&status);
//command.Format("X%0.7f",p,v);
TRACE(_T("%.7f,%.7f,%.7f\n") , p,v,t );
}
pmac.DPRAsciiStrToRotEx(dwDevice,_T("BLOCKSTOP"),coordSys,TRUE,&status);
pmac.DPRAsciiStrToRotEx(dwDevice,_T("DWELL 0"),coordSys,TRUE,&status);
pmac.DPRAsciiStrToRotEx(dwDevice,_T("X 0"),coordSys,TRUE,&status); plot.pdf