make the machine semi-auto.

Moderators: TomKerekes, dynomotion

irmad
Posts: 47
Joined: Sun Jun 07, 2020 1:39 pm

Re: make the machine semi-auto.

Post by irmad » Sat Aug 14, 2021 2:41 pm

this is a new problem again, sir. About correction axis x and y.

I made a bend of 137°, with a material thickness of 3 mm. the result is a difference, a difference of 3 degrees. for axis ( slave ) X=134° and for axis ( master ) Y=137°. can KFLOP increase or decrease the distance for one of the axes, by about 3 mm ?

i tried to write inside void main()

Code: Select all

ch0->Dest=ch0->Dest+3;
not successful. no changes.

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

Re: make the machine semi-auto.

Post by TomKerekes » Sat Aug 14, 2021 9:23 pm

Hi Irmad,

Why is there a difference? If the axes are tuned properly both axes should move the correct distance regardless of loads. You might pause at the end and check the error between the commanded Destination and the Measured Position on the KMotion Axis Screen.

Another possibility is that there is a 3mm difference when the Slave axis is Slaved to the Master. How are you squaring the master and slave?
Regards,

Tom Kerekes
Dynomotion, Inc.

irmad
Posts: 47
Joined: Sun Jun 07, 2020 1:39 pm

Re: make the machine semi-auto.

Post by irmad » Sun Aug 15, 2021 7:28 am

Anda mungkin berhenti sejenak di akhir dan memeriksa kesalahan antara Tujuan yang diperintahkan dan Posisi Terukur pada Layar Sumbu KMotion.
yes,sir.

indeed the problem is in the hydraulic position of the engine, the X and Y axes, sir. has a difference of 3 mm. for the measured position in KmotionCNC it is correct, and the X and Y movements are the same.

how can i add or subtract one of the axes by about 3 mm, at the start of init ? so that the position is the same at the start of the engine.

this is the init i made.

Code: Select all

    ch0->InputMode=ENCODER_MODE;
	ch0->OutputMode=DAC_SERVO_MODE;
	ch0->Vel=50000;
	ch0->Accel=500000;
	ch0->Jerk=5000000;
	ch0->P=10;
	ch0->I=0.1;
	ch0->D=0.1;
	ch0->FFAccel=0;
	ch0->FFVel=0;
	ch0->MaxI=0;
	ch0->MaxErr=1000000;
	ch0->MaxOutput=1024;
	ch0->DeadBandGain=1;
	ch0->DeadBandRange=0;
	ch0->InputChan0=0;
	ch0->InputChan1=0;
	ch0->OutputChan0=0;
	ch0->OutputChan1=0;
	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=100000;
	ch0->StepperAmplitude=0;

	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;



	ch1->InputMode=ENCODER_MODE;
	ch1->OutputMode=DAC_SERVO_MODE;
	ch1->Vel=50000;
	ch1->Accel=500000;
	ch1->Jerk=5000000;
	ch1->P=10;
	ch1->I=0.1;
	ch1->D=0.1;
	ch1->FFAccel=0;
	ch1->FFVel=0;
	ch1->MaxI=0;
	ch1->MaxErr=1000000;
	ch1->MaxOutput=1024;
	ch1->DeadBandGain=1;
	ch1->DeadBandRange=0;
	ch1->InputChan0=1;
	ch1->InputChan1=0;
	ch1->OutputChan0=1;
	ch1->OutputChan1=0;
	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=100000;
	ch1->StepperAmplitude=0;

	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;

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

Re: make the machine semi-auto.

Post by TomKerekes » Mon Aug 16, 2021 1:59 am

Hi irmad,

Sorry I don't understand your response, you didn't do what I asked and that is not a Complete C program.
Regards,

Tom Kerekes
Dynomotion, Inc.

irmad
Posts: 47
Joined: Sun Jun 07, 2020 1:39 pm

Re: make the machine semi-auto.

Post by irmad » Mon Aug 16, 2021 3:37 am

Bagaimana Anda mengkuadratkan tuan dan budak?
I don't know about how to use this, sir.

the height of my machine, for the x axis is higher than the y axis. about 3 mm.

this is my complete c program sir.

Code: Select all

#include "KMotionDef.h"	
#define TMP 10 // which spare persist to use to transfer data
#include "KflopToKMotionCNCFunctions.c"
#include "CoordMotionInKFLOPFunctions.c"

#define CYCLESTARTBIT 138
#define FEEDHOLDBIT 137

// function prototypes for compiler
int DoPC(int cmd);
int DoPCFloat(int cmd, float f);



void main()
{
	DefineCoordSystem(-1,-1,1,-1); // Z

	
	//--- INIT
	ch0->InputMode=ENCODER_MODE;
	ch0->OutputMode=DAC_SERVO_MODE;
	ch0->Vel=50000;
	ch0->Accel=500000;
	ch0->Jerk=5000000;
	ch0->P=3;
	ch0->I=0.01;
	ch0->D=0.5;
	ch0->FFAccel=0;
	ch0->FFVel=0;
	ch0->MaxI=3;
	ch0->MaxErr=1000000;
	ch0->MaxOutput=1024;
	ch0->DeadBandGain=0;
	ch0->DeadBandRange=0;
	ch0->InputChan0=0;
	ch0->InputChan1=0;
	ch0->OutputChan0=0;
	ch0->OutputChan1=0;
	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=1000000;
	ch0->StepperAmplitude=0;

	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;



	ch1->InputMode=ENCODER_MODE;
	ch1->OutputMode=DAC_SERVO_MODE;
	ch1->Vel=50000;
	ch1->Accel=500000;
	ch1->Jerk=5000000;
	ch1->P=3;
	ch1->I=0;
	ch1->D=0;
	ch1->FFAccel=0;
	ch1->FFVel=0;
	ch1->MaxI=2;
	ch1->MaxErr=1000000;
	ch1->MaxOutput=1024;
	ch1->DeadBandGain=0;
	ch1->DeadBandRange=0;
	ch1->InputChan0=1;
	ch1->InputChan1=0;
	ch1->OutputChan0=1;
	ch1->OutputChan1=0;
	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=1000000;
	ch1->StepperAmplitude=0;

	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;
	

	EnableAxis(0);
	EnableAxis(1);
	
	DAC(3,-1500);
	DoPC(PC_COMM_RESTART);

	int result;	
	char Y1[80];
	char Y2[90];

	for (;;) // loop forever
	{	
		WaitNextTimeSlice();
		
		// Handle Cycle Start
		if  (ReadBit(CYCLESTARTBIT))
		{
			DoPC(PC_COMM_EXECUTE);
			ResumeCoordinatedMotion();
		}
		
		// Handle feedHold
		if  (!ReadBit(CYCLESTARTBIT) && !ReadBit(FEEDHOLDBIT))
		{
			StopCoordinatedMotion();
			SetFROTemp(0);
		}
		
		// Handle feedHold reverse
		if  (ReadBit(FEEDHOLDBIT))
		{
			SetFROTemp(-1.0);
			SetBit(152);
			ClearBit(153);
			ClearBit(154);
			DAC(2,-1660);
			while(ReadBit(FEEDHOLDBIT));
			SetFROTemp(0);
			ClearBit(152);
			ClearBit(153);
			ClearBit(154);
			DAC(2,-0);
			
			while(!ReadBit(CYCLESTARTBIT));
			ClearBit(152);
			SetBit(153);
			SetBit(154);
			DAC(2,-700);
		}
		
		if (!ReadBit(139))  // manual       
		{
			ThreadDone();
			DisableAxis(0);
			DisableAxis(1);
		}

		sprintf(Y1,"Y1: %8.2f count / %8.2f mm \n",ch0->Position, ch0->Position/200);
		sprintf(Y2,"Y2: %8.2f count / %8.2f mm \n",ch1->Position, ch1->Position/200);
		
		// Put it onto the Screen
		DROLabel(1000, 162, Y1);
		DROLabel(2000, 163, Y2);
		
	
	} //--- End of loop f;;  ---
	while (!CheckDone(0) && !CheckDone(1)) ;
	DefineCoordSystem(-1,-1,1,-1); // Z

}

// Put a Float as a parameter and pass the command to the App
int DoPCFloat(int cmd, float f)
{
	int result;
	persist.UserData[PC_COMM_PERSIST+1] = *(int*)&f;
	return DoPC(cmd);
}


// Pass a command to the PC and wait for it to handshake
// that it was received by either clearing the command
// or changing it to a negative error code
int DoPC(int cmd)
{
	int result;
	
	persist.UserData[PC_COMM_PERSIST]=cmd;
	
	do
	{
		WaitNextTimeSlice();	
	}while (result=persist.UserData[PC_COMM_PERSIST]>0);
	
	printf("Result = %d\n",result);

	return result;
}




//------------

/* for restart or reboot machine

void iReboot(void);
iReboot();

*/



irmad
Posts: 47
Joined: Sun Jun 07, 2020 1:39 pm

Re: make the machine semi-auto.

Post by irmad » Tue Aug 17, 2021 7:57 pm

This is the result of bending, I tried to lower the x-axis first by about 3 mm.
Attachments
IMG_20210816_141642_1.jpg
IMG_20210816_141639.jpg

Post Reply