CL Stepper - Error Correction

Moderators: TomKerekes, dynomotion

Post Reply
CNC_Machines
Posts: 60
Joined: Fri Apr 27, 2018 10:43 pm

CL Stepper - Error Correction

Post by CNC_Machines » Mon Apr 06, 2020 5:24 pm

Greetings,

I am trying to understand the best way to get an axis to self correct position error, if it is not currently in motion. I have stepper motors with closed loop feedback. If my axis is not moving and I force the motor shaft to move, I see the encoder measure the new position on the "Axis" screen of KMotion. I would like the axis to fight back and try to return to a zero position.

I set "Max Following Error" to a high value, so I dont get a fault. I am in "CL Step" mode with an encoder. I am thinking that setting the "Max limits" on the step response screen to high values should do the trick, however it is not. Shouldnt that constantly be correcting servo position errors? When I command another move, the stepper will compensate and move to the expected position, but it doesnt do so until the next move command. Do I need to write a user program to check position error and constantly correct it?

Thanks,

Scott

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

Re: CL Stepper - Error Correction

Post by TomKerekes » Mon Apr 06, 2020 6:46 pm

Hi Scott,
I have stepper motors with closed loop feedback. If my axis is not moving and I force the motor shaft to move, I see the encoder measure the new position on the "Axis" screen of KMotion. I would like the axis to fight back and try to return to a zero position.
Yes that should happen.

I set "Max Following Error" to a high value, so I dont get a fault. I am in "CL Step" mode with an encoder. I am thinking that setting the "Max limits" on the step response screen to high values should do the trick
That is correct.

Shouldnt that constantly be correcting servo position errors?
Yes

When I command another move, the stepper will compensate and move to the expected position, but it doesnt do so until the next move command.
Are the Drives being disabled after a move completes? Are you using KStep? Many of the example default KStep initialization programs contain a forever loop which disables KStep if there has been no commanded motion for a period of time. You should remove this if you desire constant corrections to be made. See the example: \C Programs\KStep\InitKStep3AxisNoDisable.c
Regards,

Tom Kerekes
Dynomotion, Inc.

CNC_Machines
Posts: 60
Joined: Fri Apr 27, 2018 10:43 pm

Re: CL Stepper - Error Correction

Post by CNC_Machines » Mon Apr 06, 2020 7:12 pm

Thanks Tom,

No I am not using a KStep, and I am keeping the drives enabled. I am moving the motor, and then once it stops grabbing the shaft with pliers and forcing it to move. The measured position changes, the axis remains enabled, but it doesnt attempt to correct the motion.Please see the attached image.
Attachments
Settings 2.JPG

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

Re: CL Stepper - Error Correction

Post by TomKerekes » Mon Apr 06, 2020 8:56 pm

Hi Scott,

The Max Limits are only allowing 2000 microsteps of correction to be made. While forcing and holding off the position with the pliers of 1000 counts or more, the servo will quickly and futilely command the allowed 2000 microsteps of motion then stop attempting to make any more corrections.

To understand this better you might use the Step Response Screen. Set the move size to zero. Command a "Move" with 3.5 seconds of capture time. During the 3.5 seconds move the shaft with pliers. Observe the plot's Output correction quickly ramping to 2000 steps and stopping.

Closed loop with Steppers works great when making small corrections to improve accuracy. It also works great for detecting stepper motor stalls and halting the system. But doesn't normally work well for correcting gross errors caused by motor stalls and multiple miss steps. This is because once the motor stalls, attempting to move the motor more and faster will likely make the situation worse.

If you still want corrections to be made in such a case you might do the following:

#1 set max limit output and integrator to maximum allowed values of 9e11 to allow corrections to be made for a long time.
#2 set max limit error to a small number to make motor step corrections slowly enough to avoid stalling the stepper motor.

HTH
Last edited by TomKerekes on Mon Apr 06, 2020 8:57 pm, edited 1 time in total.
Reason: typo
Regards,

Tom Kerekes
Dynomotion, Inc.

CNC_Machines
Posts: 60
Joined: Fri Apr 27, 2018 10:43 pm

Re: CL Stepper - Error Correction

Post by CNC_Machines » Mon Apr 06, 2020 9:48 pm

Great! That works exactly as I was hoping. I am trying to understand "error" in the max limits. Is this the correct way of thinking that it limits the magnitude of the following error which in turn will limit the magnitude of the "output" and "integrator" correction effort on the motor? Because that effort is low, it wont command a move fast enough to stall the motor?

If that is the case, I will need to try to keep the error value higher than the typical correction the motor would try to achieve during normal operation. That way I still get the benefit of closed loop control.

Thanks,

Scott

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

Re: CL Stepper - Error Correction

Post by TomKerekes » Mon Apr 06, 2020 10:01 pm

Hi Scott,

I think what you said is basically correct. But I might quibble with some of your terms. You can't arbitrarily limit the magnitude of the following error. The following error will be whatever it happens to be. Rather the error term into the feedback system can be limited so that the feedback will not "see" such a big error and consequentially not react as violently to the error. Note that the reaction (ramp rate of the output) will be a function of the I Gain x the Error. This flow diagram may help:

ServoFlowDiagram[1].PNG
Regards,

Tom Kerekes
Dynomotion, Inc.

CNC_Machines
Posts: 60
Joined: Fri Apr 27, 2018 10:43 pm

Re: CL Stepper - Error Correction

Post by CNC_Machines » Tue Apr 07, 2020 3:03 pm

Thanks Tom, makes sense. This is for my nonlinear kinematics spray robot. Parts are coming in this week to start the build. I will post some videos as soon as it is working.

Post Reply