Ok ... I knew back when I set these parameters that the following errors were set quite tight. At the time I was going to run with them, once I got up and running, and then open them up if I needed too.
Whats strange is, I did not get any of the Y-axis following errors before on all testing until I plugged in the JP6 connector from the the MPG pendant into KFLOP. Even now, if I pull the MPG connector from the JP6 on KFLOP, then I do not get any Y-axis following errors when I start testing again.
As far as the Forever Loop added to the Init Main C-Program .... Did I added this correctly to the end?
Code:#include "KMotionDef.h" //.................................................................... // Below was added from the beginning of "MPGSmooth.c" code as Forever Loop //.................................................................... #define QA 26 // define to which IO bits the AB signals are connected #define QB 27 #define TAU 0.08 // smoothness factor (Low Pass Time constant seconds) #define FINAL_TIME 1.0 // Set final dest after this amount of time with no change // Start of Pete's Final "Init" code for Journeyman Tree 325 retrofit // 9/15/2018; added "MPGSmooth.c" code as Forever Loop at the end // and the varibles defined above. main() { SetBit(152); // enable AMPS SetBit(157); SetBit(158); // Start of Pete's Setting for X-axis RAPID ch0->InputMode=ENCODER_MODE; ch0->OutputMode=DAC_SERVO_MODE; ch0->Vel=40000; ch0->Accel=300000; ch0->Jerk=3e+06; ch0->P=1.54; ch0->I=1.8e-05; ch0->D=90; ch0->FFAccel=0.0002; ch0->FFVel=0.0376; ch0->MaxI=2500; ch0->MaxErr=100000; ch0->MaxOutput=2047; ch0->DeadBandGain=1; ch0->DeadBandRange=0; ch0->InputChan0=0; ch0->InputChan1=1; ch0->OutputChan0=0; ch0->OutputChan1=1; ch0->MasterAxis=-1; ch0->LimitSwitchOptions=0x100; ch0->LimitSwitchNegBit=0; ch0->LimitSwitchPosBit=0; 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=40; ch0->StepperAmplitude=250; 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.016609; ch0->iir[2].B1=0.033219; ch0->iir[2].B2=0.016609; ch0->iir[2].A1=1.60679; ch0->iir[2].A2=-0.673229; // End of Pete's Settings for X-axis RAPID // Start of Pete's Setting for Y-axis RAPID ch1->InputMode=ENCODER_MODE; ch1->OutputMode=DAC_SERVO_MODE; ch1->Vel=60000; ch1->Accel=500000; ch1->Jerk=800000; ch1->P=8.4; ch1->I=1e-06; ch1->D=20; ch1->FFAccel=0.0002; ch1->FFVel=0.0325; ch1->MaxI=2500; ch1->MaxErr=100000; ch1->MaxOutput=2047; ch1->DeadBandGain=1; ch1->DeadBandRange=0; ch1->InputChan0=1; ch1->InputChan1=1; ch1->OutputChan0=1; ch1->OutputChan1=1; ch1->MasterAxis=-1; ch1->LimitSwitchOptions=0x100; ch1->LimitSwitchNegBit=0; ch1->LimitSwitchPosBit=0; 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=30; ch1->StepperAmplitude=250; 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.016609; ch1->iir[2].B1=0.033219; ch1->iir[2].B2=0.016609; ch1->iir[2].A1=1.60679; ch1->iir[2].A2=-0.673229; // End of Pete's Settings for Y-axis RAPID // Start of Pete's Setting for Z-axis RAPID ch2->InputMode=ENCODER_MODE; ch2->OutputMode=DAC_SERVO_MODE; ch2->Vel=40000; ch2->Accel=600000; ch2->Jerk=280000; ch2->P=2.8; ch2->I=6e-06; ch2->D=30; ch2->FFAccel=8.7e-05; ch2->FFVel=0.04; ch2->MaxI=2500; ch2->MaxErr=100000; ch2->MaxOutput=2047; ch2->DeadBandGain=1; ch2->DeadBandRange=0; ch2->InputChan0=2; ch2->InputChan1=1; ch2->OutputChan0=2; ch2->OutputChan1=1; ch2->MasterAxis=-1; ch2->LimitSwitchOptions=0x100; ch2->LimitSwitchNegBit=0; ch2->LimitSwitchPosBit=0; 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=20; ch2->StepperAmplitude=250; 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.016609; ch2->iir[2].B1=0.033219; ch2->iir[2].B2=0.016609; ch2->iir[2].A1=1.60679; ch2->iir[2].A2=-0.673229; // End of Pete's Settings for Z-axis RAPID EnableAxis(0); EnableAxis(1); EnableAxis(2); DefineCoordSystem(0,1,2,-1); //.............................................................................. // Below was added from the end of "MPGSmooth.c" code as Forever Loop, 9/18/2018 // for my MPG Pendant connection to work. //.............................................................................. for (;;) { // convert quadrature to 2 bit binary BitA = ReadBit(QA); PosNoWrap = (ReadBit(QB) ^ BitA) | (BitA<<1); // Diff between expected position based on average of two prev deltas // and position with no wraps. (Keep as X2 to avoid division by 2) DiffX2 = 2*(Pos-PosNoWrap) + (Change2+Change1); // Calc quadrature wraparounds to bring Diff nearest zero // offset by 128 wraps to avoid requiring floor() wraps = ((DiffX2+1028)>>3)-128; // factor in the quadrature wraparounds NewPos = PosNoWrap + (wraps<<2); Change2 = Change1; Change1 = NewPos - Pos; Pos = NewPos; if (ReadBit(33)) // is X0.01 selected? Factor = 0.01; else if (ReadBit(34)) // is X0.1 selected? Factor = 0.1; else if (ReadBit(31)) // is X1 selected? Factor = 1.0; else if (ReadBit(32)) // is X100 selected? Factor = 75.0; else // must be X10 then Factor = 10.0; if (ReadBit(28)) // is x selected? Axis=0; else if (ReadBit(29)) // is y selected? Axis=1; else if (ReadBit(30)) // is z selected? Axis=2; // check if the Axis just changed or we have been // converging to the target for a long time if (Axis != LastAxis || (InMotion && Time_sec() > LastChangeTime+FINAL_TIME)) { if (InMotion) Move(LastAxis,Target); //finalize any motion LastAxis = Axis; InMotion = FALSE; } if (Change1) // did we move? { if (!InMotion) Target = chan[Axis].Dest; Target += Change1 * Factor; MoveExp(Axis,Target,TAU); // note: contains a WaitNextTimeSlice LastChangeTime = Time_sec(); InMotion=TRUE; } else { WaitNextTimeSlice(); } } return 0; }