Page 1 of 2
How to re-enable a disabled axis
Posted: Wed Oct 23, 2024 8:02 pm
by jpbarad7
I am using KFLOP in a closed-loop stepper sysem with Mach 3 and an iMach pendant control.
Everything has been working very well and I am now just trying to tweak a few of the settings, such as decreasing Max Following Error to it's lowest value to allow my axes to jog at their highest possible rates.
When I exceed the Max Following Error on any axis, that axis is immediated disabled, and an error message to that effect appears in Mach 3 (As expected).
To re-enable the disabled axis requires shutting down and restarting the PC on which the software is running, changing the Max Following Error value in KMotion, saving the C program, and reloading Mach 3 for a re-test. Simply cycling power to the KFLOP and motor drivers is not enough to clear the 'axis disabled' error.
My question is this: After an axis has become disabled due to exceeding the Max Following Error, is their an easier way to re-enable it other than shutting down and restarting the PC?
I suspect I might be able to test the Max following error limits using the movement commands within the step-response screen, but translating those units to Mach 3 is easier said than done.
Any information you can provide is appreciated.
Jim
Re: How to re-enable a disabled axis
Posted: Wed Oct 23, 2024 8:56 pm
by TomKerekes
Hi Jim,
To re-enable the disabled axis requires shutting down and restarting the PC on which the software is running, changing the Max Following Error value in KMotion, saving the C program, and reloading Mach 3 for a re-test. Simply cycling power to the KFLOP and motor drivers is not enough to clear the 'axis disabled' error.
You should be able to just re-initialize. One possibility is that your Initialize program Enables the axis with a Destination of zero. If the encoder position is far from zero then this will result in an immediate following error. There are at least 2 solutions for this. #1 Zero the axis Position so it will match the destination of 0. Note the encoders always track the position regardless of any fault unless the are explicitly zero'ed. #2 use EnableAxisDest(xx, chx->Position) to enable the axis while also setting the Destination to the encoder Position. This will allow the axis to servo wherever it is. Actually EnableAxis(xx); will do the same thing for a servo axis.
but translating those units to Mach 3 is easier said than done.
What is the difficulty? Actually the Max Following Error units and the Step Response Screen should both have units of counts. Otherwise to convert to Mach3 units divide by the resolution.
HTH
Re: How to re-enable a disabled axis
Posted: Thu Oct 24, 2024 10:44 pm
by jpbarad7
Thank you.
Option #1 worked very well.
When converting to Mach3, you said to divide the KFLOP counts by the 'resolution'.
Can you explain resolution? I'm not sure what you mean.
Thank you again.
Jim
Re: How to re-enable a disabled axis
Posted: Fri Oct 25, 2024 12:35 am
by TomKerekes
The axis resolution is the number of encoder counts per unit for the axis. For example with resolution of 2000 counts/inch if the Step Response Screen shows following errors of 40 counts that would be:
40 counts / 2000 counts/inch = 0.02 inches
HTH
Re: How to re-enable a disabled axis
Posted: Fri Oct 25, 2024 2:19 pm
by jpbarad7
Thank you.
Does this conversion formula also work for converting the motor tuning data from Kmotion to Mach3?
I am using Applied Motion Products Step-Servos and the step counts are much higher than those shown in your examples in the manual.
For example, the parameters for my X axis, after tuning with Kmotion, are as follows:
ch0->Vel=225000;
ch0->Accel=5e+06;
ch0->Jerk=1e+07;
ch0->InputGain0=-46;
ch0->MaxFollowingError=3000;
My Steps per Inch within Mach3 for this axis are: 233500
Can the Kmotion Velocity and Acceleration numbers be directly converted and used as the Velocity and Acceleration values in Mach3?
Not knowing how to do this, by trial and error, I arrived at the following for Mach3:
Velocity = 70
Acceleration = 10
Again, my system seems to be very stable and accurate, however, I feel I've arrived here by flying by the seat of my pants, rather than really understanding what is happening.
Thanks, in advance, for helping me through this....
Jim
Re: How to re-enable a disabled axis
Posted: Fri Oct 25, 2024 5:56 pm
by TomKerekes
Can the Kmotion Velocity and Acceleration numbers be directly converted and used as the Velocity and Acceleration values in Mach3?
Yes in the same way. Divide by the resolution. Velocity in Mach3 is the exception as the time units are in inches/minute instead of inches/second so there is an additional factor of 60 seconds/minute.
225000 counts/second / 233500 counts/inch x 60 seconds/minute = 57.8 inches/minute
5e6 counts/second^2 / 233500 counts/inch = 21.4 inches/second^2
Sometimes you may not want to set the parameters in KFLOP and Mach3 to be exactly the same because the parameters in KMotion have jerk limits and the parameters in Mach3 do not. The parameters in KFLOP are used for Rapid moves (G0) and the parameters in Mach2 are used for feeding through paths (G1, G2, G3). Jerk limited moves are basically smoother than non-Jerk limited moves. But limiting Jerk tends to slow things down, however the smoother motion may allow higher acceleration and velocity to be used which results in net improvement in performance.
An analogy might be in a car. Say you want to stop as fast as possible without spilling your coffee. You might be able to stop faster by applying the brakes somewhat gradually but very hard, as compared to slamming on the brakes less hard. You might see this
wiki article.
Re: How to re-enable a disabled axis
Posted: Fri Oct 25, 2024 9:00 pm
by jpbarad7
Thank you. That helped me a great deal.
I have the KFLOP installed on a SuperMax Knee mill in a standard X Y Z configuration. In addition, I have the knee operating in closed loop fashion using Ch3 (C axis) and an open loop (thus far) stepper on Ch4 (A axis), for a future rotary axis.
When I press the 'Reference' button on Mach3, the X Y Z axes zero out on both the Machine Coordinates and Part Coordinates, but Ch4 (which is the 'A' axis only zeros within the Machine Coordinate system (an additional push of the 'Zero 4' button on the Mach3 display) is required to zero the part coordinate system. Ch3 (C axis) is not zeroed in either coordinate system when the 'Reference' button is pressed.
I do not have my machine set up to home to the limit switches. I just want it to be able to set the machine and part zero to a specific point - usually the same as the CAD/CAM program zero.
I edited the ref buttons on the Mach3 screen using the Dietz editor as instructed in the KFLOP manual.
I have been trying to modify the NotifyZeroMach3 program by adding text to zero the A (ch4) and C (ch3) axes, but nothing I do is working. I suspect I am doing something wrong. This is my latest code:
#include "KMotionDef.h"
//Plugin calls for Mach3 NotifyPlugins Commands
#define X 0
#define Y 1
#define Z 2
#define C 3
#define A 4
main()
{
int msg = persist.UserData[6]; // Mach3 notify Message 10000-10999
printf("Mach3 Notify Call, Message = %d\n",msg);
if (msg==10100)
{
// adjust the commanded position to match the glass scale encoder
DisableAxis(X);
EnableAxisDest(X,chan[X].Position);
}
if (msg==10101)
{
// adjust the commanded position to match the glass scale encoder
DisableAxis(Y);
EnableAxisDest(Y,chan[Y].Position);
}
if (msg==10102)
{
// adjust the commanded position to match the glass scale encoder
DisableAxis(Z);
EnableAxisDest(Z,chan[Z].Position);
}
if (msg==10103)
{
// adjust the commanded position to match the glass scale encoder
DisableAxis(C);
EnableAxisDest(C,chan[C].Position);
}
if (msg==10104)
{
// adjust the commanded position to match the glass scale encoder
DisableAxis(A);
EnableAxisDest(A,chan[A].Position);
}
if (msg==10500)
{
if (CS0_StoppingState == 0)
StopCoordinatedMotion();
else
ResumeCoordinatedMotion();
}
if (msg==10300)
{
// User wants to disable Z (switch to OL)
DisableAxis(Z);
chan[Z].OutputMode = STEP_DIR_MODE;
EnableAxisDest(Z,chan[Z].Position);
}
if (msg==10301)
{ // User wants to enable Z (switch to CL)
DisableAxis(Z);
chan[Z].OutputMode = CL_STEP_DIR_MODE;
EnableAxisDest(Z,chan[Z].Position);
}
}
Any help you can provide is greatly appreciated.
Jim
Re: How to re-enable a disabled axis
Posted: Fri Oct 25, 2024 10:48 pm
by TomKerekes
Hi Jim,
Do you have a Mach3 screen set with 5 reference buttons? What is it? Which tab are they on? What are they configured to do?
I think the Ref buttons configured for function 'Ref X" will call the Homing Program not the Notification Program.
Add printf statements to the X code in the Homing program to see if it is actually being called.
Re: How to re-enable a disabled axis
Posted: Sat Oct 26, 2024 12:37 am
by jpbarad7
Tom,
No. I am using the standard Mach3 screen with 4 axes displayed. Those axes are on the tabs set up for that screen
Right now, I'd like my knee (ch3, C axis) to display in that spot instead of my A axis which currently displays there. I haven't figured out how to do that yet either.
I've also tried to tinker with the homing program, unsuccessfully (see below).
I'm not sure if I have the 'flags' assigned correctly, or if I need to modify KMotionDef.h because I am adding more axes.
Also, because I'm not wanting my machine to move to limit switches as home, can I do away with all the jog commands?
Thanks again!
Jim
#include "KMotionDef.h"
//Plugin calls for Mach3 Home (actually Purge) Commands
//Called from Mach3 "REF" command
//in this case just Zero the measured position (encoder)
//and set the commanded destination to zero
#define X 0
#define Y 1
#define Z 2
#define A 3
#define C 5
main()
{
int flags = persist.UserData[5]; // Mach3 flags bit0=X, bit1=Y, Bit2=Z, etc...
printf("Mach3 Home Call, flags = %d\n",flags);
if (flags & 1)
{
DisableAxis(X);
Zero(X);
EnableAxisDest(X,0.0);
Jog(X,10000); // start moving
while (ReadBit(8)) ; // wait for switch (input #15) to change
Jog(X,0); // StopMotion
while(!CheckDone(X)) ;
Jog(X,-5000); // start moving
while (!ReadBit(8)) ; // wait for switch (input #15) to change
Jog(X,0); // StopMotion
while(!CheckDone(X)) ;
Delay_sec(.25);
DisableAxis(X);
Zero(X);
EnableAxisDest(X,0.0);
}
if (flags & 2)
{
DisableAxis(Y);
Zero(Y);
EnableAxisDest(Y,0.0);
Jog(Y,10000); // start moving
while (ReadBit(9)) ; // wait for switch (input #15) to change
Jog(Y,0); // StopMotion
while(!CheckDone(Y)) ;
Jog(Y,-3000); // start moving
while (!ReadBit(9)) ; // wait for switch (input #15) to change
Jog(Y,0); // StopMotion
while(!CheckDone(Y)) ;
Delay_sec(.25);
DisableAxis(Y);
Zero(Y);
EnableAxisDest(Y,0.0);
}
if (flags & 4)
{
DisableAxis(Z);
Zero(Z);
EnableAxisDest(Z,0.0);
Jog(Z,10000); // start moving
while (ReadBit(10)) ; // wait for switch (input #15) to change
Jog(Z,0); // StopMotion
while(!CheckDone(Z)) ;
Jog(Z,-5000); // start moving
while (!ReadBit(10)) ; // wait for switch (input #15) to change
Jog(Z,0); // StopMotion
while(!CheckDone(Z)) ;
Delay_sec(.25);
DisableAxis(Z);
Zero(Z);
EnableAxisDest(Z,0.0);
}
if (flags & 5)
{
DisableAxis(A);
Zero(A);
EnableAxisDest(A,0.0);
Jog(A,10000); // start moving
while (ReadBit(10)) ; // wait for switch (input #15) to change
Jog(A,0); // StopMotion
while(!CheckDone(Z)) ;
Jog(A,-5000); // start moving
while (!ReadBit(10)) ; // wait for switch (input #15) to change
Jog(A,0); // StopMotion
while(!CheckDone(A)) ;
Delay_sec(.25);
DisableAxis(A);
Zero(A);
EnableAxisDest(A,0.0);
}
if (flags & 6)
{
DisableAxis(C);
Zero(C);
EnableAxisDest(C,0.0);
Jog(C,10000); // start moving
while (ReadBit(10)) ; // wait for switch (input #15) to change
Jog(C,0); // StopMotion
while(!CheckDone(Z)) ;
Jog(C,-5000); // start moving
while (!ReadBit(10)) ; // wait for switch (input #15) to change
Jog(C,0); // StopMotion
while(!CheckDone(C)) ;
Delay_sec(.25);
DisableAxis(C);
Zero(C);
EnableAxisDest(C,0.0);
}
}
Re: How to re-enable a disabled axis
Posted: Sat Oct 26, 2024 4:14 pm
by TomKerekes
Hi Jim,
Mach3 passes flags as a packed binary value where each bit corresponds to an axis. That way Mach3 can command multiple axes to home at the same time. So the axes XYZABC would correspond to values 1 2 4 8 16 32
Yes the Jog to home switch stuff can be removed if you don't have home switches.
Please add printf statements so we can see exactly what Mach3 is sending. Such as:
I don't see any Ref Buttons on the Settings screen.
Please post C Code inside the code tags </> so it is more readable