Code:
#include "stdafx.h"
#include "CoordMotion.h"
// Global Variables
CKMotionDLL *KM;
CCoordMotion *CM;
int count=0; // just count the callbacks
void StraightTraverseCallback(double x, double y, double z, int sequence_number)
{
count++;
}
void StraightFeedCallback(double DesiredFeedRate_in_per_sec,
double x, double y, double z, int sequence_number, int ID)
{
count++;
}
void ArcFeedCallback(bool ZeroLenAsFullCircles, double DesiredFeedRate_in_per_sec,
CANON_PLANE plane,
double first_end, double second_end,
double first_axis, double second_axis, int rotation,
double axis_end_point,
double first_start, double second_start, double axis_start_point, int sequence_number, int ID)
{
count++;
}
void CV1Dlg::OnBnClickedButton2()
{
// TODO: Add your control notification handler code here
KM = new CKMotionDLL(0); // create as board 0
CM = new CCoordMotion(KM);
char response[MAX_LINE];
MOTION_PARAMS *p=CM->GetMotionParams();
p->BreakAngle = 30;
p->MaxAccelX = 100;
p->MaxAccelY = 100;
p->MaxAccelZ = 100;
p->MaxAccelA = 100;
p->MaxVelX = 2000;
p->MaxVelY = 2000;
p->MaxVelZ = 2000;
p->MaxVelA = 2000;
p->CountsPerInchX = 100;
p->CountsPerInchY = 100;
p->CountsPerInchZ = 100;
p->CountsPerInchA = 100;
//p->DegreesA = p->DegreesB = p->DegreesC = FALSE;
p->ArcsToSegs = true;
CM->SetTPParams(); // Apply motion parameters to the Trajectory Planner
CM->SetAbort();
CM->ClearAbort();
CM->SetStraightTraverseCallback(StraightTraverseCallback);
CM->SetStraightFeedCallback(StraightFeedCallback);
CM->SetArcFeedCallback(ArcFeedCallback);
double Speed = 50; //inch/sec
int result = CM->ReadCurAbsPosition(&CM->current_x,&CM->current_y,&CM->current_z,
&CM->current_a,&CM->current_b,&CM->current_c,true);
CM->StraightTraverse(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000); // jump back to zero
CM->StraightFeed(Speed, 100, 100, 100, 100, 0.0, 0.0, 0, 0); // Move X,Y,Z, and A 100 units, but the only thing I get is X and Y moving 100
CM->FlushSegments();
return 0;
}
Best,