I hope you're doing well.
I'm reaching out for help with a puzzling issue I’ve encountered on the Z axis encoder. I’ve attached my initialization file, which I’ve stripped down to just the Z axis to better isolate the problem.
Here’s what I’m seeing:
• As the Z carriage moves down, the ZDRO matches the encoder reading divided by the Z axis parameter (Z_Param) in the Trajectory Planner perfectly—until it reaches -19mm.
• Beyond -19mm, the encoder reading begins to drift from the ZDRO. I’ve included a table below to show the deviation:
Code: Select all
Z DRO (mm) Z Encoder Pos/Z_Param Z Encoder Pos/Z_Param
(with Encoder Zeroed at -20mm)
-18.000 -18.000
-19.000 -19.000
-20.000 -20.001 0.000
-21.000 -21.012 -1.000
-22.000 -22.022 -2.000
-23.000 -23.039 -3.000
-24.000 -24.056 -4.000
-25.000 -25.069 -5.000
-26.000 -26.081 -6.000
-27.000 -27.099 -7.000
-28.000 -28.112 -8.000
-29.000 -29.128 -9.000
-30.000 -30.142 -10.000
I’ve tested the encoder connection either through Encoder #10 via Kogna’s JP8 or Encoder #0 via Kanalog’s JP1, and the results are identical—so I don’t think it’s a hardware connection issue. The magnetic encoder I used has minimum edge separation of 0.25us (4MHz).
Would you be able to take a look and let me know what might be causing this discrepancy? Any guidance would be greatly appreciated.
Many thanks!!!
#include "KMotionDef.h"
int main()
{
ch2->InputMode=ENCODER_MODE;
ch2->OutputMode=CL_STEP_DIR_MODE;
ch2->Vel=272000;
ch2->Accel=2720000;
ch2->Jerk=15000000;
ch2->P=0.2;
ch2->I=0.008;
ch2->D=1.6;
ch2->FFAccel=0;
ch2->FFVel=0.004;
ch2->MaxI=10000;
ch2->MaxErr=1e+09;
ch2->MaxOutput=10000;
ch2->DeadBandGain=1;
ch2->DeadBandRange=0;
ch2->InputChan0=0; // OR ch2->InputChan0=10;
ch2->InputChan1=0;
ch2->OutputChan0=146;
ch2->OutputChan1=0;
ch2->MasterAxis=-1;
ch2->LimitSwitchOptions=0x100;
ch2->LimitSwitchNegBit=2;
ch2->LimitSwitchPosBit=2;
ch2->SoftLimitPos=1e+30;
ch2->SoftLimitNeg=-1e+30;
ch2->InputGain0=3.2;
ch2->InputGain1=1;
ch2->InputOffset0=0;
ch2->InputOffset1=0;
ch2->OutputGain=-1;
ch2->OutputOffset=0;
ch2->SlaveGain=1;
ch2->BacklashMode=BACKLASH_OFF;
ch2->BacklashAmount=200;
ch2->BacklashRate=2000;
ch2->invDistPerCycle=1;
ch2->Lead=0;
ch2->MaxFollowingError=10000;
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.000768788;
ch2->iir[2].B1=0.00153758;
ch2->iir[2].B2=0.000768788;
ch2->iir[2].A1=1.92076;
ch2->iir[2].A2=-0.923833;
EnableAxisDest(2, ch2->Position);
DefineCoordSystem(-1,-1,2,-1);
SetBitDirection(21,1); SetBit(21);
return 0;
}