int TestPtToPtMotionInPCSCommand() { // NMCSERVO Servo; int iModules; int iError; long lPosition; double dXPosition,dYPosition,dZPosition; double dCmdXPosition,dCmdYPosition,dCmdZPosition; double dCmdXSpeed,dCmdYSpeed,dCmdZSpeed; double dCmdXAccel,dCmdYAccel,dCmdZAccel; double dVelocity; double dXHome, dYHome, dZHome; byte byAD; iModules=g_stage.Initialize("COM9:"); SetScaling_3Axis(); SetPIDGain_3Axis(); g_stage.Rotate(180.0); g_stage.SetVel(3.0, 3.0, 3.0); g_stage.SetAccel(1.0, 1.0, 1.0); g_stage.EnableAmp(); g_stage.ResetPos(); g_stage.GetCmdVel(dCmdXSpeed, dCmdYSpeed, dCmdZSpeed); g_stage.GetSpeed(dCmdXSpeed, dCmdYSpeed, dCmdZSpeed); g_stage.GetCmdAccel(dCmdXAccel, dCmdYAccel, dCmdZAccel ); millCmd millctrl; BOOL bMotion; // iError=g_stage.MoveTo(0.0, 0.0, 0.0, true); // g_stage.GetPos(dXPosition, dYPosition, dZPosition ); stageMoveXYZ *stagemove1 = new stageMoveXYZ(g_stage, 0.0, 0.0, 0.0); millctrl.SetCommand(stagemove1); stageGetPos *stagegetpos1 = new stageGetPos(g_stage); millctrl.SetCommand(stagegetpos1); double x,y,z; // x=0.5;y= 0.0;z= 0.0; // iError=g_stage.MoveTo(x,y,z, true); // g_stage.GetPos(dXPosition, dYPosition, dZPosition ); stageMoveXYZ *stagemove2 = new stageMoveXYZ(g_stage,0.5, 0.0, 0.0); millctrl.SetCommand(stagemove2); stageGetPos *stagegetpos2 = new stageGetPos(g_stage); millctrl.SetCommand(stagegetpos2); // x=0.0;y= 0.5;z= 0.0; // iError=g_stage.MoveTo(x,y,z, true); // g_stage.GetPos(dXPosition, dYPosition, dZPosition ); stageMoveXYZ *stagemove3 = new stageMoveXYZ(g_stage,0.0, 0.5, 0.0); millctrl.SetCommand(stagemove3); stageGetPos *stagegetpos3 = new stageGetPos(g_stage); millctrl.SetCommand(stagegetpos3); // x=-0.5;y= 0.0;z= 0.0; // iError=g_stage.MoveTo(x,y,z, true); // g_stage.GetPos(dXPosition, dYPosition, dZPosition ); stageMoveXYZ *stagemove4 = new stageMoveXYZ(g_stage,-0.5, 0.0, 0.0); millctrl.SetCommand(stagemove4); stageGetPos *stagegetpos4 = new stageGetPos(g_stage); millctrl.SetCommand(stagegetpos4); // x=0.0;y= -0.5;z= 0.0; // iError=g_stage.MoveTo(x,y,z, true); // g_stage.GetPos(dXPosition, dYPosition, dZPosition ); stageMoveXYZ *stagemove5 = new stageMoveXYZ(g_stage,0.0, -0.5, 0.0); millctrl.SetCommand(stagemove5); stageGetPos *stagegetpos5 = new stageGetPos(g_stage); millctrl.SetCommand(stagegetpos5); // x=0.5;y= 0.5;z= 0.0; // iError=g_stage.MoveTo(x,y,z, true); // g_stage.GetPos(dXPosition, dYPosition, dZPosition ); stageMoveXYZ *stagemove6 = new stageMoveXYZ(g_stage,0.5, 0.5, 0.0); millctrl.SetCommand(stagemove6); stageGetPos *stagegetpos6 = new stageGetPos(g_stage); millctrl.SetCommand(stagegetpos6); // x=-0.5;y= -0.5;z= 0.0; // iError=g_stage.MoveTo(x,y,z, true); // g_stage.GetPos(dXPosition, dYPosition, dZPosition ); stageMoveXYZ *stagemove7 = new stageMoveXYZ(g_stage,-0.5, 0.5, 0.0); millctrl.SetCommand(stagemove7); stageGetPos *stagegetpos7 = new stageGetPos(g_stage); millctrl.SetCommand(stagegetpos7); // x=0.5;y= -0.5;z= 0.0; // iError=g_stage.MoveTo(x,y,z, true); // g_stage.GetPos(dXPosition, dYPosition, dZPosition ); stageMoveXYZ *stagemove8 = new stageMoveXYZ(g_stage,0.5, -0.5, 0.0); millctrl.SetCommand(stagemove8); stageGetPos *stagegetpos8 = new stageGetPos(g_stage); millctrl.SetCommand(stagegetpos8); // x=-0.5;y= 0.5;z= 0.0; // iError=g_stage.MoveTo(x,y,z, true); // g_stage.GetPos(dXPosition, dYPosition, dZPosition ); stageMoveXYZ *stagemove9 = new stageMoveXYZ(g_stage,-0.5, 0.5, 0.0); millctrl.SetCommand(stagemove9); stageGetPos *stagegetpos9 = new stageGetPos(g_stage); millctrl.SetCommand(stagegetpos9); int numberOfCommands =millctrl.GetNumberOfCommands(); for (int i=0; i <= numberOfCommands-1;i++) { millctrl.execute(i); } // iError=Servo.move(-8000,2); // do{ // bMotion=Servo.IsInMotion(); // } // while(bMotion); // g_stage.GetHome( dXHome, dYHome, dZHome); return 0; }
int TestPtToPtMotionInPCSWithStage() { // NMCSERVO Servo; int iModules; int iError; long lPosition; double dXPosition,dYPosition,dZPosition; double dCmdXPosition,dCmdYPosition,dCmdZPosition; double dCmdXSpeed,dCmdYSpeed,dCmdZSpeed; double dCmdXAccel,dCmdYAccel,dCmdZAccel; double dVelocity; double dXHome, dYHome, dZHome; byte byAD; iModules=g_stage.Initialize("COM3:"); SetScaling_3Axis(); SetPIDGain_3Axis(); g_stage.Rotate(180.0); g_stage.SetVel(3.0, 3.0, 3.0); g_stage.SetAccel(1.0, 1.0, 1.0); g_stage.EnableAmp(); g_stage.ResetPos(); g_stage.GetCmdVel(dCmdXSpeed, dCmdYSpeed, dCmdZSpeed); g_stage.GetSpeed(dCmdXSpeed, dCmdYSpeed, dCmdZSpeed); g_stage.GetCmdAccel(dCmdXAccel, dCmdYAccel, dCmdZAccel ); BOOL bMotion; iError=g_stage.MoveTo(0.0, 0.0, 0.0, true); g_stage.GetPos(dXPosition, dYPosition, dZPosition ); double x,y,z; x=0.5;y= 0.0;z= 0.0; iError=g_stage.MoveTo(x,y,z, true); g_stage.GetPos(dXPosition, dYPosition, dZPosition ); x=0.0;y= 0.5;z= 0.0; iError=g_stage.MoveTo(x,y,z, true); g_stage.GetPos(dXPosition, dYPosition, dZPosition ); x=-0.5;y= 0.0;z= 0.0; iError=g_stage.MoveTo(x,y,z, true); g_stage.GetPos(dXPosition, dYPosition, dZPosition ); x=0.0;y= -0.5;z= 0.0; iError=g_stage.MoveTo(x,y,z, true); g_stage.GetPos(dXPosition, dYPosition, dZPosition ); x=0.5;y= 0.5;z= 0.0; iError=g_stage.MoveTo(x,y,z, true); g_stage.GetPos(dXPosition, dYPosition, dZPosition ); x=-0.5;y= -0.5;z= 0.0; iError=g_stage.MoveTo(x,y,z, true); g_stage.GetPos(dXPosition, dYPosition, dZPosition ); x=0.5;y= -0.5;z= 0.0; iError=g_stage.MoveTo(x,y,z, true); g_stage.GetPos(dXPosition, dYPosition, dZPosition ); x=-0.5;y= 0.5;z= 0.0; iError=g_stage.MoveTo(x,y,z, true); g_stage.GetPos(dXPosition, dYPosition, dZPosition ); // iError=Servo.move(-8000,2); // do{ // bMotion=Servo.IsInMotion(); // } // while(bMotion); // g_stage.GetHome( dXHome, dYHome, dZHome); return 0; }