Keep Backlash in the Control Loop

Moderators: TomKerekes, dynomotion

Post Reply
suumas
Posts: 5
Joined: Sat Dec 05, 2020 4:51 pm

Keep Backlash in the Control Loop

Post by suumas » Fri Oct 28, 2022 5:29 am

I'd like to start by saying I absolutely love your product. I've been using it for at least 10 years and it's made so much possible for me!!!

I have a mill with closed loop AC servos and 1um scales. I use the scales to measure position and treat the servos like steppers since the backlash and dynamics under load are too severe (.005-.011) to rely on the servo encoders alone. Thanks to the abundant feature set, I've managed to tune everything nicely and the tool converges on the destination point as intended. However, any change in direction lags due the backlash in the system, resulting in gouging when cutting pockets or inside threads. Apart from costly upgrades there's nothing left to do physically so I want to use backlash, but it appears the backlash operates outside the control loop and results in missing the destination by that amount.

For an exaggerated example, I set the backlash to 0.010 and moved 1 inch. It executes the initial jump but the control loop ignores the additional output and simply moves 1 inch + 0.010, missing the destination exactly by the backlash. When reversing direction, it reverses the backlash, moves 1 inch back, and accurately returns to the starting position. It seems like the backlash operates outside control loop, which makes sense if the encoder were attached to the actuator, but in this case the encoder can see the actual position and just ignores it because it's backlash. Is it possible to modify the control loop to handle backlash the same as though I physically kicked the milling table and only move the remainder? Maybe a new backlash injection mode feature request?

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

Re: Keep Backlash in the Control Loop

Post by TomKerekes » Fri Oct 28, 2022 6:35 pm

Hi suumas,
However, any change in direction lags due the backlash in the system, resulting in gouging when cutting pockets or inside threads.
My understanding is that you have Step/Dir Drives (that are closed loop from the rotary encoders) with KFLOP using Closed Loop Step/Dir using the linear scales as feedback.

Without any backlash correction, KFLOP properly corrects for the backlash but the correction doesn't happen fast enough so there is a momentary error.

Are you sure the loops are fully optimized?

For an exaggerated example, I set the backlash to 0.010 and moved 1 inch. It executes the initial jump but the control loop ignores the additional output and simply moves 1 inch + 0.010, missing the destination exactly by the backlash. When reversing direction, it reverses the backlash, moves 1 inch back, and accurately returns to the starting position. It seems like the backlash operates outside control loop, which makes sense if the encoder were attached to the actuator, but in this case the encoder can see the actual position and just ignores it because it's backlash. Is it possible to modify the control loop to handle backlash the same as though I physically kicked the milling table and only move the remainder? Maybe a new backlash injection mode feature request?
Your explanation of how backlash is implemented is correct. It assumes there is backlash after the axis.

Its not clear to me how you could have both closed loop correcting for backlash with backlash. Maybe something like apply the backlash quickly and then gradually remove it and allow the closed loop to take over the correction? But then small moves might be an issue.

Below is the current code used to control Backlash. You might turn off backlash correction and try to do something yourself in a User Program or User Call Back. If you find something that works we will consider including it. chx->Backlash should be applied regardless whether Backlash compensation is turned on or not.

I'm not a big fan of backlash correction. I don't think I've seen a case where it helps significantly.

Code: Select all

void DoBacklash(CHAN *chx)
{
	if (chx->Dest > chx->PrevBacklashDest + chx->BacklashAmount*0.005)// moving forward?
	{
		chx->PrevBacklashDest = chx->Dest;
		chx->BacklashDirection = 1;
	}
	else if (chx->Dest < chx->PrevBacklashDest - chx->BacklashAmount*0.005)// moving backward?
	{
		chx->PrevBacklashDest = chx->Dest;
		chx->BacklashDirection = -1;
	}

	chx->Backlash += chx->BacklashRate * chx->BacklashDirection * TIMEBASE;
	
	if (chx->Backlash > chx->BacklashAmount)
		chx->Backlash = chx->BacklashAmount;
	else if (chx->Backlash < 0.0f)
		chx->Backlash = 0.0f;
}
Regards,

Tom Kerekes
Dynomotion, Inc.

suumas
Posts: 5
Joined: Sat Dec 05, 2020 4:51 pm

Re: Keep Backlash in the Control Loop

Post by suumas » Fri Oct 28, 2022 10:51 pm

I've tried tuning the axii to respond quicker but I've never been able to find a combination parameters that are stable at all speeds and still accurate under load. When moving at low speed, error does not accumulate fast enough, but increasing the integral coef quickly causes oscillation at higher speed. I basically want to use backlash like a position feed forward to inject movement that is guaranteed to be made without waiting on the PID loop. However, my derivative coefficient right now is 0 so I will revisit this to see if there's something I can improve.

Where is DoBacklash implemented? I imagine that's on the board, right? Is it possible to overload that with a user program?

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

Re: Keep Backlash in the Control Loop

Post by TomKerekes » Fri Oct 28, 2022 11:30 pm

Where is DoBacklash implemented? I imagine that's on the board, right? Is it possible to overload that with a user program?
Yes that is an internal function that is called if Backlash Compensation is turned on. So if you turn off backlash compensation it won't be called. Then create a similar function in a User Program and call it in a loop. I'd start by doing exactly that to see if you get the same result using your code then if so make modifications. Note a User Program with only one thread running with a forever loop with one WaitNextTimelice() will loop every 180us. Where KFLOP would call that every 90us. So the TIMEBASE should be changed to 2.0 * TIMEBASE to get the same Backlash rate.
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply