1
Mach SDK plugin questions and answers. / Re: Movement plugin problems
« on: June 17, 2009, 12:21:50 PM »
Hi everyone,
I'm having the exact same problem as the original poster above... Could someone please help me out?
All I'm attempting to do is dump the values of the GMoves structure to a logfile, but none of the values make sense, given the simple G Code I'm running... Mach3 does fill the ring buffer (that is to say, TrajHead is moving).
I think I'm probably missing some setting in the initialization... I'm also using Visual Studio 2008 (if that could be a problem).
The code I currently have looks something like this (logfile bits stripped out)...
//----------------------------------------------------------------------------------------------------------------------
void myInitControl()
{
MachView->m_PrinterOn = false;
MainPlanner->ExternalType = EX_VMS;
MainPlanner->ExTime = .001;
}
//----------------------------------------------------------------------------------------------------------------------
void myUpdate ()
{
int axis;
// Check for GMoves to handle...
while(Engine->TrajHead != Engine->TrajIndex)
{
// Here is where I try to dump the sx, sy, sz, ex, ey, ez values of the GMoves structure to a logfile...
// MainPlanner->Movements[Engine->TrajIndex].sx
// MainPlanner->Movements[Engine->TrajIndex].sy
// MainPlanner->Movements[Engine->TrajIndex].sz
// MainPlanner->Movements[Engine->TrajIndex].ex
// MainPlanner->Movements[Engine->TrajIndex].ey
// MainPlanner->Movements[Engine->TrajIndex].ez
axis = 0;
while(axis < 6)
{
// Here is where I try to dump the DDA values of the GMoves structure to a logfile...
// MainPlanner->Movements[Engine->TrajIndex].DDA1[axis]
// MainPlanner->Movements[Engine->TrajIndex].DDA2[axis]
// MainPlanner->Movements[Engine->TrajIndex].DDA3[axis]
axis++;
}
// Go to the next move...
Engine->TrajIndex = (Engine->TrajIndex+1) & 0xfff;
}
}
//----------------------------------------------------------------------------------------------------------------------
The logfile output looks something like this...
Movement[0]
Start 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
End 0.000000 0.000000 5.388000 1.000000 0.000000 0.000000
Axis 0...
DDA1 == 0.0000000000
DDA2 == 0.0000000000
DDA3 == 0.0000000000
Axis 1...
DDA1 == 1.8075690409
DDA2 == -0.0283553731
DDA3 == -0.0283553731
Axis 2...
DDA1 == 0.0000000000
DDA2 == 0.0000000000
DDA3 == 0.0000000000
Axis 3...
DDA1 == 0.0000000000
DDA2 == 0.0000000000
DDA3 == 0.0000000000
Axis 4...
DDA1 == 0.0000000000
DDA2 == 0.0000000000
DDA3 == 0.0000000000
Axis 5...
DDA1 == 0.0000000000
DDA2 == 0.0000000000
DDA3 == 0.0000000000
...With the DDA's being handled as fixed point numbers (top 32 bits for signed whole number, lower 32 bits for unsigned portion past the decimal point)...
Any help would be greatly appreciated.
Thanks,
-Aaron
I'm having the exact same problem as the original poster above... Could someone please help me out?
All I'm attempting to do is dump the values of the GMoves structure to a logfile, but none of the values make sense, given the simple G Code I'm running... Mach3 does fill the ring buffer (that is to say, TrajHead is moving).
I think I'm probably missing some setting in the initialization... I'm also using Visual Studio 2008 (if that could be a problem).
The code I currently have looks something like this (logfile bits stripped out)...
//----------------------------------------------------------------------------------------------------------------------
void myInitControl()
{
MachView->m_PrinterOn = false;
MainPlanner->ExternalType = EX_VMS;
MainPlanner->ExTime = .001;
}
//----------------------------------------------------------------------------------------------------------------------
void myUpdate ()
{
int axis;
// Check for GMoves to handle...
while(Engine->TrajHead != Engine->TrajIndex)
{
// Here is where I try to dump the sx, sy, sz, ex, ey, ez values of the GMoves structure to a logfile...
// MainPlanner->Movements[Engine->TrajIndex].sx
// MainPlanner->Movements[Engine->TrajIndex].sy
// MainPlanner->Movements[Engine->TrajIndex].sz
// MainPlanner->Movements[Engine->TrajIndex].ex
// MainPlanner->Movements[Engine->TrajIndex].ey
// MainPlanner->Movements[Engine->TrajIndex].ez
axis = 0;
while(axis < 6)
{
// Here is where I try to dump the DDA values of the GMoves structure to a logfile...
// MainPlanner->Movements[Engine->TrajIndex].DDA1[axis]
// MainPlanner->Movements[Engine->TrajIndex].DDA2[axis]
// MainPlanner->Movements[Engine->TrajIndex].DDA3[axis]
axis++;
}
// Go to the next move...
Engine->TrajIndex = (Engine->TrajIndex+1) & 0xfff;
}
}
//----------------------------------------------------------------------------------------------------------------------
The logfile output looks something like this...
Movement[0]
Start 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
End 0.000000 0.000000 5.388000 1.000000 0.000000 0.000000
Axis 0...
DDA1 == 0.0000000000
DDA2 == 0.0000000000
DDA3 == 0.0000000000
Axis 1...
DDA1 == 1.8075690409
DDA2 == -0.0283553731
DDA3 == -0.0283553731
Axis 2...
DDA1 == 0.0000000000
DDA2 == 0.0000000000
DDA3 == 0.0000000000
Axis 3...
DDA1 == 0.0000000000
DDA2 == 0.0000000000
DDA3 == 0.0000000000
Axis 4...
DDA1 == 0.0000000000
DDA2 == 0.0000000000
DDA3 == 0.0000000000
Axis 5...
DDA1 == 0.0000000000
DDA2 == 0.0000000000
DDA3 == 0.0000000000
...With the DDA's being handled as fixed point numbers (top 32 bits for signed whole number, lower 32 bits for unsigned portion past the decimal point)...
Any help would be greatly appreciated.
Thanks,
-Aaron