Slaved axis out of sync when moving less than full speed

Moderators: TomKerekes, dynomotion

Post Reply
Photojet
Posts: 11
Joined: Mon Sep 27, 2021 2:06 pm

Slaved axis out of sync when moving less than full speed

Post by Photojet » Mon Sep 27, 2021 2:37 pm

Hello,

My name is Martin and I'm struggling with the setup of the slaved Y axis on my CNC, which should run with KFLOP and 4 stepper motors with integrated closed loop drivers(KFLOP is not managing encoders, the drivers do that). I managed to get all 4 motors running and I've configured Y axis on channel 1- "Master axis -1", and setup the slaved to it one on channel 3 with "Master axis 1" and Slave gain 1" as those should always run in sync.
However, when you jog those at the max preset speed, they do run in sync and as soon as you try and jog at lower speed, one is far slower than the other.
This happens both in Mach3 (when you input less than 100% jog speed)and in KMotinCNC when you press the fast and slow jog buttons.
In the Trajectory planner of KMotionCNC all parameters of Y and A axis are identical.

Would you please advise how to fix that as I couldn't find information neither in the Wiki nor in the forum. Thank you!

User avatar
TomKerekes
Posts: 2527
Joined: Mon Dec 04, 2017 1:49 am

Re: Slaved axis out of sync when moving less than full speed

Post by TomKerekes » Mon Sep 27, 2021 5:50 pm

Hi Martin,

A common mistake is to configure the Slave axis as the A axis. The Slave should not be an Axis and be left out of the Coordinated Motion System. Only the Master is part of the Coordinated Motion System. From the perspective of GCode the Slave doesn't exist.

Post your Initialization C Program.
Regards,

Tom Kerekes
Dynomotion, Inc.

Photojet
Posts: 11
Joined: Mon Sep 27, 2021 2:06 pm

Re: Slaved axis out of sync when moving less than full speed

Post by Photojet » Mon Sep 27, 2021 8:27 pm

Hi Tom,

Thank you for your exceptionally quick reply!Her below is the initialization programme:

#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=NO_INPUT_MODE;
ch0->OutputMode=STEP_DIR_MODE;
ch0->Vel=50000;
ch0->Accel=200000;
ch0->Jerk=4e+06;
ch0->P=0;
ch0->I=0.01;
ch0->D=0;
ch0->FFAccel=0;
ch0->FFVel=0;
ch0->MaxI=200;
ch0->MaxErr=1e+06;
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=0;
ch0->LimitSwitchPosBit=1;
ch0->SoftLimitPos=1e+09;
ch0->SoftLimitNeg=-1e+09;
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=1;
ch0->iir[2].B1=0;
ch0->iir[2].B2=0;
ch0->iir[2].A1=0;
ch0->iir[2].A2=0;


EnableAxisDest(0,0);

ch1->InputMode=NO_INPUT_MODE;
ch1->OutputMode=STEP_DIR_MODE;
ch1->Vel=50000;
ch1->Accel=200000;
ch1->Jerk=4e+06;
ch1->P=0;
ch1->I=0.01;
ch1->D=0;
ch1->FFAccel=0;
ch1->FFVel=0;
ch1->MaxI=200;
ch1->MaxErr=1e+06;
ch1->MaxOutput=200;
ch1->DeadBandGain=1;
ch1->DeadBandRange=0;
ch1->InputChan0=1;
ch1->InputChan1=0;
ch1->OutputChan0=1;
ch1->OutputChan1=0;
ch1->MasterAxis=-1;
ch1->LimitSwitchOptions=0x113;
ch1->LimitSwitchNegBit=2;
ch1->LimitSwitchPosBit=3;
ch1->SoftLimitPos=1e+09;
ch1->SoftLimitNeg=-1e+09;
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=1;
ch1->iir[2].B1=0;
ch1->iir[2].B2=0;
ch1->iir[2].A1=0;
ch1->iir[2].A2=0;


EnableAxisDest(1,0);

ch2->InputMode=NO_INPUT_MODE;
ch2->OutputMode=STEP_DIR_MODE;
ch2->Vel=30000;
ch2->Accel=200000;
ch2->Jerk=4e+06;
ch2->P=0;
ch2->I=0.01;
ch2->D=0;
ch2->FFAccel=0;
ch2->FFVel=0;
ch2->MaxI=200;
ch2->MaxErr=1e+06;
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=4;
ch2->LimitSwitchPosBit=5;
ch2->SoftLimitPos=1e+09;
ch2->SoftLimitNeg=-1e+09;
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,0);

ch3->InputMode=NO_INPUT_MODE;
ch3->OutputMode=STEP_DIR_MODE;
ch3->Vel=50000;
ch3->Accel=200000;
ch3->Jerk=4e+08;
ch3->P=0;
ch3->I=0.01;
ch3->D=0;
ch3->FFAccel=0;
ch3->FFVel=0;
ch3->MaxI=200;
ch3->MaxErr=1e+06;
ch3->MaxOutput=200;
ch3->DeadBandGain=1;
ch3->DeadBandRange=0;
ch3->InputChan0=0;
ch3->InputChan1=0;
ch3->OutputChan0=3;
ch3->OutputChan1=0;
ch3->MasterAxis=1;
ch3->LimitSwitchOptions=0x110;
ch3->LimitSwitchNegBit=0;
ch3->LimitSwitchPosBit=0;
ch3->SoftLimitPos=1e+09;
ch3->SoftLimitNeg=-1e+09;
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=1;
ch3->iir[2].B1=0;
ch3->iir[2].B2=0;
ch3->iir[2].A1=0;
ch3->iir[2].A2=0;
EnableAxisDest(3,0);

DefineCoordSystem(0,1,2,-1);

return 0;
}

User avatar
TomKerekes
Posts: 2527
Joined: Mon Dec 04, 2017 1:49 am

Re: Slaved axis out of sync when moving less than full speed

Post by TomKerekes » Tue Sep 28, 2021 5:06 pm

Hi Martin,

The Init Program looks correct.

Which one moves slower? Which if any move at the correct speed? What is the speed? Are the Master and Slave mechanically linked?

Have you tested the slave separately? Can it move at slow speeds properly? You might de-Slave it and test it using the Step Response Screen. Or configure it as the Y with:

DefineCoordSystem(0,3,2,-1);

and Jog it from KMotionCNC.
Regards,

Tom Kerekes
Dynomotion, Inc.

Photojet
Posts: 11
Joined: Mon Sep 27, 2021 2:06 pm

Re: Slaved axis out of sync when moving less than full speed

Post by Photojet » Wed Sep 29, 2021 12:09 pm

Hi Tom,

I de-slaved the Y axis and in the Step Response screen it was moving absolutely fine at high speed - 50 000 and acceleration 200 0000, and when I lowered it to let's say 5 000 it was not moving at all, which was odd. So, I swapped the drivers of the Y and the slaved axis and it turned out that there's something wrong with the stepper driver, as the same behaviour now appeared on the Y axis. I sent the driver back to the supplier and should get a new one tomorrow but it looks like everything should work just fine now. Thanks for your help on the matter.

Post Reply