584,866 active members*
5,271 visitors online*
Register for free
Login
Results 1 to 9 of 9
  1. #1
    Join Date
    Dec 2004
    Posts
    132

    Kmotion CNC question/gripe

    On one of my Kflop setups, I am using a keyboard with a decent length cord as a pendant for the machine. This generally works well, except that occasionally I press the ESC key sometimes, which is like pressing the STOP button in KMotionCNC. When I do this on a stepper setup with no feedback, the X,Y,Z coordinates change to some seemingly random number when they go from green to yellow on the DRO. When I re initialize the machine and the DRO goes back to green, then numbers change again to some other coordinate that also has nothing to do with where the machine was commanded last. Why is this? Could I make a request for future updates that the machine remembers it's last commanded position? It seems to make basic sense that this is how the program would operate. Instead, if by chance the ESC key is pressed, I now have to reset the XYZ so that I might finish whatever job I have running.

  2. #2
    Join Date
    May 2006
    Posts
    4043

    Re: Kmotion CNC question/gripe

    Hi spank,

    KFLOP normally remembers it last commanded position. It depends what your Stop Action is configured to do and how your system Initializes.

    What Version of KMotion are you using?

    What is the KMotionCNC | Tool Setup | M0-M30 | Stop action configured to do?

    How are your Axes being enabled in your initialization Program? EnableAxisDest(0,ch0->Dest); will enable the axis and set the commanded position to the last commanded destination.

    Note that "Stop" will normally stop abruptly with a chance that the stepper motors will miss-step and so the last commanded position may not match the actual physical position. If possible use "Halt" to stop in a controlled manner that should not loose steps and also not disable axes.

    HTH
    TK
    http://dynomotion.com

  3. #3
    Join Date
    Dec 2004
    Posts
    132

    Re: Kmotion CNC question/gripe

    Quote Originally Posted by TomKerekes View Post
    Hi spank,

    KFLOP normally remembers it last commanded position. It depends what your Stop Action is configured to do and how your system Initializes.

    What Version of KMotion are you using?

    What is the KMotionCNC | Tool Setup | M0-M30 | Stop action configured to do?

    How are your Axes being enabled in your initialization Program? EnableAxisDest(0,ch0->Dest); will enable the axis and set the commanded position to the last commanded destination.

    Note that "Stop" will normally stop abruptly with a chance that the stepper motors will miss-step and so the last commanded position may not match the actual physical position. If possible use "Halt" to stop in a controlled manner that should not loose steps and also not disable axes.

    HTH

    Hi Tom,
    My apologies, I thought I had responded last week, but it looks like I either never pressed submit or something got lost in the ether. At any rate, I am using Kmotion version 4.34. Stop action in KmotionCNC is set to NONE.

    I modified my axis enable to what you suggested, and this works, but only if I have jogged the machine to a position. If I actually command the machine somewhere via G0 or G1, then I get the same behavior that I originally described.

    I am aware of not using STOP in practice for the reasons that you pointed out, and I never usually do unless it is a mistake (I see this wasn't entirely clear in my original post!). Since this mistake almost always occurs when the machine is stationary, losing steps is never an issue.

    -Spank

  4. #4
    Join Date
    May 2006
    Posts
    4043

    Re: Kmotion CNC question/gripe

    Hi Spank,

    Strange I've never heard of such behavior. I can't think of how sitting at some position would be different after running GCode vs Jogging.

    Please post a screen shot of how all your M0-M30 Actions are configured.

    Please post any C Programs you are using.

    Please perform the following test:

    #1 run both KMotion.exe and KMotionCNC.exe

    #2 Clear all GCode offsets and Select Mach Coordinates in KMotionCNC

    #3 Jog somewhere ie X=1 Y=1

    #4 Record the KMotionCNC DROs and the axis positions in the KMotion.exe Axis Screen

    #5 Push ESC

    #6 Record the KMotionCNC DROs and the axis positions in the KMotion.exe Axis Screen

    #7 Push INIT

    #8 Record the KMotionCNC DROs and the axis positions in the KMotion.exe Axis Screen


    Now repeat the Test but change step #3 to move using G0X1Y1

    Regards
    TK
    http://dynomotion.com

  5. #5
    Join Date
    Dec 2004
    Posts
    132

    Re: Kmotion CNC question/gripe

    Thanks for the response Tom.

    Here is my INIT program:
    Code:
    #include "KMotionDef.h"
    
    // Defines axis 0, 1, 2 as simple step dir TTL outputs for KSTEP
    // enables them
    // sets them as an xyz coordinate system for GCode
    
    int main() 
    {
    	double T0, LastX=0, LastY=0, LastZ=0, LastA=0, Tau;
    	
    	KStepPresent=TRUE;      // enable KSTEP input multiplexing
    	FPGA(KAN_TRIG_REG)=4;  	// Mux PWM0 to JP7 Pin5 IO 44 for KSTEP 
    
    	FPGA(STEP_PULSE_LENGTH_ADD) = 63 + 0x80;  // set polarity and pulse length to 4us
    	
    	ch0->InputMode=NO_INPUT_MODE;
    	ch0->OutputMode=STEP_DIR_MODE;
    	ch0->Vel=20000;
    	ch0->Accel=200000;
    	ch0->Jerk=4e+006;
    	ch0->P=0;
    	ch0->I=0.01;
    	ch0->D=0;
    	ch0->FFAccel=0;
    	ch0->FFVel=0;
    	ch0->MaxI=200;
    	ch0->MaxErr=1e+006;
    	ch0->MaxOutput=200;
    	ch0->DeadBandGain=1;
    	ch0->DeadBandRange=0;
    	ch0->InputChan0=0;
    	ch0->InputChan1=0;
    	ch0->OutputChan0=8;
    	ch0->OutputChan1=0;
    	ch0->MasterAxis=-1;
    	ch0->LimitSwitchOptions=0x0;
    	ch0->InputGain0=1;
    	ch0->InputGain1=1;
    	ch0->InputOffset0=0;
    	ch0->InputOffset1=0;
    	ch0->OutputGain=1;
    	ch0->OutputOffset=0;
    	ch0->SlaveGain=1;
    	ch0->BacklashMode=BACKLASH_OFF;
    	ch0->BacklashAmount=0;
    	ch0->BacklashRate=0;
    	ch0->invDistPerCycle=1;
    	ch0->Lead=0;
    	ch0->MaxFollowingError=1000000000;
    	ch0->StepperAmplitude=20;
    
    	ch0->iir[0].B0=1;
    	ch0->iir[0].B1=0;
    	ch0->iir[0].B2=0;
    	ch0->iir[0].A1=0;
    	ch0->iir[0].A2=0;
    
    	ch0->iir[1].B0=1;
    	ch0->iir[1].B1=0;
    	ch0->iir[1].B2=0;
    	ch0->iir[1].A1=0;
    	ch0->iir[1].A2=0;
    
    	ch0->iir[2].B0=0.000769;
    	ch0->iir[2].B1=0.001538;
    	ch0->iir[2].B2=0.000769;
    	ch0->iir[2].A1=1.92076;
    	ch0->iir[2].A2=-0.923833;
        EnableAxisDest(0,ch1->Dest);
    
    	ch1->InputMode=NO_INPUT_MODE;
    	ch1->OutputMode=STEP_DIR_MODE;
    	ch1->Vel=20000;
    	ch1->Accel=200000;
    	ch1->Jerk=4e+006;
    	ch1->P=0;
    	ch1->I=0.01;
    	ch1->D=0;
    	ch1->FFAccel=0;
    	ch1->FFVel=0;
    	ch1->MaxI=200;
    	ch1->MaxErr=1e+006;
    	ch1->MaxOutput=200;
    	ch1->DeadBandGain=1;
    	ch1->DeadBandRange=0;
    	ch1->InputChan0=0;
    	ch1->InputChan1=0;
    	ch1->OutputChan0=9;
    	ch1->OutputChan1=0;
    	ch1->MasterAxis=0;
    	ch1->LimitSwitchOptions=0x0;
    	ch1->InputGain0=1;
    	ch1->InputGain1=1;
    	ch1->InputOffset0=0;
    	ch1->InputOffset1=0;
    	ch1->OutputGain=-1;
    	ch1->OutputOffset=0;
    	ch1->SlaveGain=1;
    	ch1->BacklashMode=BACKLASH_OFF;
    	ch1->BacklashAmount=0;
    	ch1->BacklashRate=0;
    	ch1->invDistPerCycle=1;
    	ch1->Lead=0;
    	ch1->MaxFollowingError=1000000000;
    	ch1->StepperAmplitude=20;
    
    	ch1->iir[0].B0=1;
    	ch1->iir[0].B1=0;
    	ch1->iir[0].B2=0;
    	ch1->iir[0].A1=0;
    	ch1->iir[0].A2=0;
    
    	ch1->iir[1].B0=1;
    	ch1->iir[1].B1=0;
    	ch1->iir[1].B2=0;
    	ch1->iir[1].A1=0;
    	ch1->iir[1].A2=0;
    
    	ch1->iir[2].B0=0.000769;
    	ch1->iir[2].B1=0.001538;
    	ch1->iir[2].B2=0.000769;
    	ch1->iir[2].A1=1.92076;
    	ch1->iir[2].A2=-0.923833;
        EnableAxisDest(1,ch2->Dest);
    
    	ch2->InputMode=NO_INPUT_MODE;
    	ch2->OutputMode=STEP_DIR_MODE;
    	ch2->Vel=20000;
    	ch2->Accel=200000;
    	ch2->Jerk=4e+006;
    	ch2->P=0;
    	ch2->I=0.01;
    	ch2->D=0;
    	ch2->FFAccel=0;
    	ch2->FFVel=0;
    	ch2->MaxI=200;
    	ch2->MaxErr=1e+006;
    	ch2->MaxOutput=200;
    	ch2->DeadBandGain=1;
    	ch2->DeadBandRange=0;
    	ch2->InputChan0=0;
    	ch2->InputChan1=0;
    	ch2->OutputChan0=10;
    	ch2->OutputChan1=0;
    	ch2->MasterAxis=-1;
    	ch2->LimitSwitchOptions=0x0;
    	ch2->InputGain0=1;
    	ch2->InputGain1=1;
    	ch2->InputOffset0=0;
    	ch2->InputOffset1=0;
    	ch2->OutputGain=1;
    	ch2->OutputOffset=0;
    	ch2->SlaveGain=1;
    	ch2->BacklashMode=BACKLASH_OFF;
    	ch2->BacklashAmount=0;
    	ch2->BacklashRate=0;
    	ch2->invDistPerCycle=1;
    	ch2->Lead=0;
    	ch2->MaxFollowingError=1000000000;
    	ch2->StepperAmplitude=20;
    
    	ch2->iir[0].B0=1;
    	ch2->iir[0].B1=0;
    	ch2->iir[0].B2=0;
    	ch2->iir[0].A1=0;
    	ch2->iir[0].A2=0;
    
    	ch2->iir[1].B0=1;
    	ch2->iir[1].B1=0;
    	ch2->iir[1].B2=0;
    	ch2->iir[1].A1=0;
    	ch2->iir[1].A2=0;
    
    	ch2->iir[2].B0=1;
    	ch2->iir[2].B1=0;
    	ch2->iir[2].B2=0;
    	ch2->iir[2].A1=0;
    	ch2->iir[2].A2=0;
    	EnableAxisDest(2,ch3->Dest);
    	
    	ch3->InputMode=NO_INPUT_MODE;
    	ch3->OutputMode=STEP_DIR_MODE;
    	ch3->Vel=6000;
    	ch3->Accel=200000;
    	ch3->Jerk=4e+006;
    	ch3->P=0;
    	ch3->I=0.01;
    	ch3->D=0;
    	ch3->FFAccel=0;
    	ch3->FFVel=0;
    	ch3->MaxI=200;
    	ch3->MaxErr=1e+006;
    	ch3->MaxOutput=200;
    	ch3->DeadBandGain=1;
    	ch3->DeadBandRange=0;
    	ch3->InputChan0=0;
    	ch3->InputChan1=0;
    	ch3->OutputChan0=11;
    	ch3->OutputChan1=0;
    	ch3->MasterAxis=-1;
    	ch3->LimitSwitchOptions=0x0;
    	ch3->InputGain0=1;
    	ch3->InputGain1=1;
    	ch3->InputOffset0=0;
    	ch3->InputOffset1=0;
    	ch3->OutputGain=-1;
    	ch3->OutputOffset=0;
    	ch3->SlaveGain=1;
    	ch3->BacklashMode=BACKLASH_OFF;
    	ch3->BacklashAmount=0;
    	ch3->BacklashRate=0;
    	ch3->invDistPerCycle=1;
    	ch3->Lead=0;
    	ch3->MaxFollowingError=1000000000;
    	ch3->StepperAmplitude=20;
    
    	ch3->iir[0].B0=1;
    	ch3->iir[0].B1=0;
    	ch3->iir[0].B2=0;
    	ch3->iir[0].A1=0;
    	ch3->iir[0].A2=0;
    
    	ch3->iir[1].B0=1;
    	ch3->iir[1].B1=0;
    	ch3->iir[1].B2=0;
    	ch3->iir[1].A1=0;
    	ch3->iir[1].A2=0;
    
    	ch3->iir[2].B0=0.000769;
    	ch3->iir[2].B1=0.001538;
    	ch3->iir[2].B2=0.000769;
    	ch3->iir[2].A1=1.92076;
    	ch3->iir[2].A2=-0.923833;
    	EnableAxisDest(3,0);
    
    	DefineCoordSystem(0,2,3,-1);
    	
    	SetBitDirection(45,1);  // set Enable Signal as Output
    	SetBit(45);				// Enable the amplifiers
    	
    //  Add a small amount of Coordinated Motion Path smoothing if desired
    //	Tau = 0.001;  // seconds for Low Pass Filter Time Constant
    //	KLP = exp(-TIMEBASE/Tau);
    	KLP=0; // force to 0 to disable
    //	printf("Tau=%f KLP=%f\n",Tau,KLP);
    	
    	
    	for (;;) // loop forever
    	{
    		WaitNextTimeSlice();
    		
    		// Service Amplifier disable after no activity for a while
    		if (ch0->Dest != LastX || ch1->Dest != LastY || ch2->Dest != LastZ || ch3->Dest != LastA)
    		{
    			// we moved - enable KStep Amplifers
    			SetBit(45);
    			T0 = Time_sec();  // record the time and position of last motion
    			LastX=ch0->Dest;
    			LastY=ch1->Dest;
    			LastZ=ch2->Dest; 
    		}
    		else
    		{
    			if (Time_sec() > T0 + 10.0) ClearBit(45);
    		}
    	}
    
        return 0;
    }
    I cleared all of my offsets and ran the test that you suggested. I cannot repeat the behavior that I noted earlier strangely enough, although I am positive that I was able to reinitialize the machine at the same position after jogging but not after commanding via G1/G0. Now it appears that the shift in position is consistent, at least so far as a shift occurs.

    Jogging:

    Jogging to position:
    x: 8.3188
    y: 5.5521

    ESC/REINIT

    x: 6.6533
    y: 0.0000

    SAME Test G1:

    After commanding G1 x5 y5:

    x: 7.1797
    y: 5.0000

    ESC/REINIT

    x: 6.6635
    y: 3.8378

    (all positions in Mach coordinates)
    -Spank

  6. #6
    Join Date
    May 2006
    Posts
    4043

    Re: Kmotion CNC question/gripe

    Hi Spank,

    I see in your INIT program it initializes:

    Axis 0 to where Axis 1 was
    Axis 1 to where Axis 2 was
    Axis 2 to where Axis 3 was
    Axis 3 to 0.

    Can you see this?

    I think that's why the coordinates seem scrambled. I assume your axis resolutions are different so the values don't appear simply swapped around on the DROs. That's why I had asked you to report the KMotion Axis Screen Destinations.

    On a side note, I also don't understand why after commanding GCode to move to X5Y5 the X DRO doesn't read 5.
    TK
    http://dynomotion.com

  7. #7
    Join Date
    Dec 2004
    Posts
    132

    Re: Kmotion CNC question/gripe

    Hi Tom,

    Thank you again for your help. Yes, I see my mistake there, and correcting that seems to resolve the problem. Your question about the DRO positions not reading 5 when commanded five has to do with selecting machine coordinates as you asked for in your test. Doing this turns the DRO red, and the position there doesn't reflect where I am actually sending the machine. If I switch back to floating origin, then the DRO reads the position properly as it relates to the commanded position. Also, I apologize about not sending the Axis screen destinations before, I didn't see that request until you asked again about them. I just randomly zeroed x and y, took note of the axis dest, commanded G0 x5 y5 and took another note. These positions did not change after stopping/reinit:

    0,0 Axis 1: -95027.37 Axis 2; -99524.3 Axis 3 -12921.9 g0 x5 y5: Axis 1 -74645.2 Axis2: -79142.13 Axis3: 7460.27

    Thanks again for your help.

    -Spank


    -Spank

  8. #8
    Join Date
    May 2006
    Posts
    4043

    Re: Kmotion CNC question/gripe

    Hi Spank,

    Your question about the DRO positions not reading 5 when commanded five has to do with selecting machine coordinates as you asked for in your test. Doing this turns the DRO red, and the position there doesn't reflect where I am actually sending the machine. If I switch back to floating origin, then the DRO reads the position properly as it relates to the commanded position.
    That would indicate an X Axis GCode offset (G92, Fixture, or Tool) hadn't been cleared. With no offsets the GCode Coordinates should be the same as Machine coordinates.

    Thanks for your patience.
    TK
    http://dynomotion.com

  9. #9
    Join Date
    Dec 2004
    Posts
    132
    Quote Originally Posted by TomKerekes View Post
    Hi Spank,

    That would indicate an X Axis GCode offset (G92, Fixture, or Tool) hadn't been cleared. With no offsets the GCode Coordinates should be the same as Machine coordinates.

    Thanks for your patience.

    Hah! Thanks for yours!

Similar Threads

  1. Kmotion cnc
    By BRAIL in forum Autodesk CAM
    Replies: 1
    Last Post: 01-22-2017, 04:02 PM
  2. KMotion CNC.net
    By bradodarb in forum Dynomotion/Kflop/Kanalog
    Replies: 60
    Last Post: 08-15-2016, 03:24 PM
  3. GRIPE TIME
    By Steve Seebold in forum Tormach Personal CNC Mill
    Replies: 12
    Last Post: 06-18-2016, 03:34 PM
  4. Basic question: how do I get Kmotion to create Bode plots?
    By amowry in forum Dynomotion/Kflop/Kanalog
    Replies: 15
    Last Post: 11-28-2015, 09:42 PM
  5. Feed hold question in Kmotion CNC
    By Troy_O in forum Dynomotion/Kflop/Kanalog
    Replies: 5
    Last Post: 04-07-2015, 08:37 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •