586,103 active members*
3,321 visitors online*
Register for free
Login
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2010
    Posts
    34

    Motion Control Question

    Sorry if I word this wrong but my question is about motion control between Mach3 and Kflop. I have almost completed my swap from LPT control to Kflop with mostly good success. The problem I am running into is that the motion can change from normal speed motion to a ramping speed motion.

    Example: I boot the machine and home X,Y,Z, and A. In MDI mode I move the X axis to move 10" at a feed rate of 100" per min. All works well. If I hit an E Stop and do this again, The X Axis will start at 100" per min but ramp down to about 50" per min at about 5" then start ramping back up to 100" per min as it approaches 10" The only way to get the proper motion again is to reboot the Kflop board.

    I'm sure I am missing something simple in the initialization program and I have yet to configure KmotionCNC to see if the issue exists there as well. Do I need to define a motion control program in the initialization program?

    [CODE#include "KMotionDef.h"

    // Defines axis 0, 1, 2 as simple step dir outputs
    // enables them
    // sets them as an xyz coordinate system for GCode

    int main()
    {
    ch0->InputMode=ENCODER_MODE;
    ch0->OutputMode=STEP_DIR_MODE;
    ch0->Vel=1e+008;
    ch0->Accel=4e+008;
    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=0;
    ch0->OutputChan1=0;
    ch0->MasterAxis=-1;
    ch0->LimitSwitchOptions=0x113;
    ch0->LimitSwitchNegBit=1024;
    ch0->LimitSwitchPosBit=1025;
    ch0->SoftLimitPos=1e+009;
    ch0->SoftLimitNeg=-1e+009;
    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,ch0->Dest); // X Axis

    ch1->InputMode=NO_INPUT_MODE;
    ch1->OutputMode=STEP_DIR_MODE;
    ch1->Vel=1e+008;
    ch1->Accel=4e+008;
    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=1;
    ch1->InputChan1=0;
    ch1->OutputChan0=1;
    ch1->OutputChan1=0;
    ch1->MasterAxis=0;
    ch1->LimitSwitchOptions=0x110;
    ch1->LimitSwitchNegBit=0;
    ch1->LimitSwitchPosBit=0;
    ch1->SoftLimitPos=1e+009;
    ch1->SoftLimitNeg=-1e+009;
    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.92081;
    ch1->iir[2].A2=-0.923885;


    EnableAxisDest(1,ch1->Dest); // X Axis Slave

    ch2->InputMode=NO_INPUT_MODE;
    ch2->OutputMode=STEP_DIR_MODE;
    ch2->Vel=1e+008;
    ch2->Accel=4e+008;
    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=2;
    ch2->InputChan1=0;
    ch2->OutputChan0=2;
    ch2->OutputChan1=0;
    ch2->MasterAxis=-1;
    ch2->LimitSwitchOptions=0x113;
    ch2->LimitSwitchNegBit=1026;
    ch2->LimitSwitchPosBit=1027;
    ch2->SoftLimitPos=1e+009;
    ch2->SoftLimitNeg=-1e+009;
    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=0.000769;
    ch2->iir[2].B1=0.001538;
    ch2->iir[2].B2=0.000769;
    ch2->iir[2].A1=1.92081;
    ch2->iir[2].A2=-0.923885;

    EnableAxisDest(2,ch2->Dest); // Y Axis

    ch3->InputMode=NO_INPUT_MODE;
    ch3->OutputMode=STEP_DIR_MODE;
    ch3->Vel=40000;
    ch3->Accel=400000;
    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=3;
    ch3->InputChan1=0;
    ch3->OutputChan0=3;
    ch3->OutputChan1=0;
    ch3->MasterAxis=-1;
    ch3->LimitSwitchOptions=0x113;
    ch3->LimitSwitchNegBit=1028;
    ch3->LimitSwitchPosBit=1029;
    ch3->SoftLimitPos=1e+009;
    ch3->SoftLimitNeg=-1e+009;
    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.92081;
    ch3->iir[2].A2=-0.923885;

    EnableAxisDest(3,ch3->Dest); // Z Axis

    ch4->InputMode=NO_INPUT_MODE;
    ch4->OutputMode=STEP_DIR_MODE;
    ch4->Vel=40000;
    ch4->Accel=400000;
    ch4->Jerk=4e+006;
    ch4->P=0.2;
    ch4->I=0;
    ch4->D=0;
    ch4->FFAccel=0;
    ch4->FFVel=0;
    ch4->MaxI=200;
    ch4->MaxErr=200;
    ch4->MaxOutput=200;
    ch4->DeadBandGain=1;
    ch4->DeadBandRange=0;
    ch4->InputChan0=4;
    ch4->InputChan1=1;
    ch4->OutputChan0=4;
    ch4->OutputChan1=1;
    ch4->MasterAxis=-1;
    ch4->LimitSwitchOptions=0x111;
    ch4->LimitSwitchNegBit=1030;
    ch4->LimitSwitchPosBit=0;
    ch4->SoftLimitPos=1e+009;
    ch4->SoftLimitNeg=-1e+009;
    ch4->InputGain0=1;
    ch4->InputGain1=1;
    ch4->InputOffset0=0;
    ch4->InputOffset1=0;
    ch4->OutputGain=1;
    ch4->OutputOffset=0;
    ch4->SlaveGain=1;
    ch4->BacklashMode=BACKLASH_OFF;
    ch4->BacklashAmount=0;
    ch4->BacklashRate=0;
    ch4->invDistPerCycle=1;
    ch4->Lead=0;
    ch4->MaxFollowingError=10000000;
    ch4->StepperAmplitude=250;

    ch4->iir[0].B0=1;
    ch4->iir[0].B1=0;
    ch4->iir[0].B2=0;
    ch4->iir[0].A1=0;
    ch4->iir[0].A2=0;

    ch4->iir[1].B0=1;
    ch4->iir[1].B1=0;
    ch4->iir[1].B2=0;
    ch4->iir[1].A1=0;
    ch4->iir[1].A2=0;

    ch4->iir[2].B0=1;
    ch4->iir[2].B1=0;
    ch4->iir[2].B2=0;
    ch4->iir[2].A1=0;
    ch4->iir[2].A2=0;

    EnableAxisDest(4,ch4->Dest); // A Axis

    DefineCoordSystem(0,2,3,4);

    // Configure KFLOP to service Konnect 32 Input 16 output IO board
    // Board address is 0,
    // 16 Outputs are mapped to Virtual IO 48-63 (VirtualBits)
    // 32 Inputs are mapped to Virtual IO 1024-1055 (VirtualBits[0])
    //
    // Attach Service to Aux0 Port (KFLOP JP4) instead of standard Aux1 Port (KFLOP JP6)

    InitAux();
    AddKonnect_Aux0(0,&VirtualBits,VirtualBitsEx);
    return 0;
    // Estop
    for (; //loop forever
    {
    WaitNextTimeSlice();

    // if ESTOP present disable any enabled Axis ??
    #define ESTOP_BIT 1032
    if (ReadBit(ESTOP_BIT))
    {
    if (ch0->Enable) DisableAxis(0); // axis still enabled? - Disable it
    if (ch1->Enable) DisableAxis(1); // axis still enabled? - Disable it
    if (ch2->Enable) DisableAxis(2); // axis still enabled? - Disable it
    if (ch3->Enable) DisableAxis(2); // axis still enabled? - Disable it
    if (ch4->Enable) DisableAxis(2); // axis still enabled? - Disable it
    }
    }
    }
    ][/CODE]

  2. #2
    Join Date
    Aug 2004
    Posts
    244

    Re: Motion Control Question

    A quick look and I see ch0->InputMode=ENCODER_MODE while the rest are set to NO_INPUT_MODE; not sure if you this was your intention but does not look right.
    Everything in moderation, including moderation.

  3. #3
    Join Date
    May 2006
    Posts
    4045

    Re: Motion Control Question

    Hi Joe,

    Your Max Accelerations and Velocities are set crazy high (100,000,000 steps/sec). KFLOP can only generate 2.5MHz Step pulses and most Stepper Drivers can only handle a few hundred KHz. You might read this article (especially the last paragraph):
    Dynomotion

    Although Mach3 will use its settings for MDI Moves if you have crazy settings in KFLOP maybe you have crazy settings in Mach3 also? What values for motor tuning do you have in Mach3?

    Regards
    TK
    TK
    http://dynomotion.com

  4. #4
    Join Date
    Dec 2010
    Posts
    34

    Re: Motion Control Question

    Tom, I apologize for wasting your time, you are correct, the numbers are way off. I had been experimenting with all sorts of settings and forgot to put the values back where they belong. When set correctly, the problem goes away.
    Mach3 is set with more reasonable numbers.

    Here is what I am using
    NEMA 27 steppers @ 285 in/oz
    200 pulses per rev
    micro stepped at 1/10 =2000 pulses per rev
    5mm pitch ball screws = 5.08 revs per inch or
    10160 pulses per inch
    250 inches per min is as fast as I feel comfortable running my machine so total pulse count per minute = 2540000
    So, if I did my math correctly, the Kflop velocity is set about 42333 pulses per sec.

    I didn't understand second and third order motion until I re-read your suggested article.



    Sent from my iPhone using Tapatalk

Similar Threads

  1. CNC USB Motion Control
    By mkanney6 in forum News Announcements
    Replies: 1
    Last Post: 04-10-2016, 09:45 AM
  2. K Flop motion control question
    By popspipes in forum Tormach Personal CNC Mill
    Replies: 4
    Last Post: 12-17-2014, 07:28 PM
  3. VFD for motion control?
    By PeteBo in forum Phase Converters
    Replies: 0
    Last Post: 05-10-2013, 04:26 PM
  4. Help with motion control set up
    By ho-229 in forum Maintenance DIY Discussion
    Replies: 0
    Last Post: 10-23-2011, 01:05 PM
  5. Motion Control
    By mikemill in forum Controller & Computer Solutions
    Replies: 0
    Last Post: 04-26-2008, 04:54 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
  •