G code smoothing-Motor Tuning or Both?

Moderators: TomKerekes, dynomotion

Post Reply
msmart
Posts: 11
Joined: Mon Feb 18, 2019 10:18 pm

G code smoothing-Motor Tuning or Both?

Post by msmart » Thu Feb 28, 2019 2:42 pm

I have Kflop and Kanalog on a Lagun knee mill which originally had an Anilam controller. I have retained the analog drives and motors . The feedback to Kflop is from linear scales.

I seem to have X, Y and Z working well and added 4th axis. This has a dc servo with a rotary encoder as feedback and the rotary table movement to motor is a 90:1 ratio. I thought I had this axis tuned well enough until I attempted to run coordinated motion.

The CAM software I'm using (MadCAM) outputs many short, small linear and rotational movements for both the feed moves and rapids (see attached). I didn't notice any problems with 3 axis movements but am with 4 axis. The coordinated 4 axis rapids are especially bad-the motion is jerky as it tries to execute all the code.
WRT Rough Test 2.txt
(447.6 KiB) Downloaded 139 times
Initially I was using Mach 3 which was really bad (became unstable), then tried Kmotion CNC which was a little better, but far from smooth. I have contacted MadCAM to find out if there are settings that can change the output of the code.

I did fiddle some in the Trajectory planner to see if I could smooth that way without any noticeable changes in behavior. So the question is...

G code smoothing-Motor Tuning or Both? (or I suppose neither)

I have also attached a screenshot of the step response screen from the 4th axis. The output looks very different than the other ones...don't know if this is due to it being rotary?
Capture 3.PNG

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

Re: G code smoothing-Motor Tuning or Both?

Post by TomKerekes » Thu Feb 28, 2019 5:37 pm

Hi msmart,

I've never seen CAM output bursts of short Rapids like that. KMotionCNC only combines/smooths Feeds not Rapids. Rapids will be handled as 3rd order exact stop type of moves. I can't imagine why the CAM would do that. Especially since they appear to be forming a perfectly straight line. The CAM looks to be limiting the rapids to less than 1 degree of motion. For example starting at line 195 (see below). All the intermediate Rapids should be able to be removed at no consequence. Here is a plot:

AvsX.png
AvsX.png (9.55 KiB) Viewed 3339 times

Your tuning looks reasonable. I can't really see what the error is at that scale. It is better to plot error when the errors are small. Also post the raw data so we can re-plot ourselves.

The Integrator Gain is probably way too high, but then it is limited to 10 DAC counts so is effectively turned off. So it would be better to reduce the I gain to something like 0.001 and increase the Integrator limit to something like 500. But I doubt if that is related to the issue you are having.

Please post your Trajectory planner settings.

Example data starting at line 195

G00Z5.186
G00X2.219A152.302
G00X2.207A153.241
G00X2.195A154.180
G00X2.184A155.119
G00X2.172A156.058
G00X2.160A156.997
G00X2.149A157.936
G00X2.137A158.875
G00X2.126A159.814
G00X2.114A160.753
G00X2.102A161.691
G00X2.091A162.630
G00X2.079A163.569
G00X2.067A164.508
G00X2.056A165.447
G00X2.044A166.386
G00X2.033A167.325
G00X2.021A168.264
G00X2.009A169.203
G00X1.998A170.142
G00X1.986A171.080
G00X1.975A172.019
G00X1.963A172.958
G00X1.951A173.897
G00X1.940A174.836
G00X1.928A175.775
G00X1.916A176.714
G00X1.905A177.653
G00X1.893A178.592
G00X1.882A179.531
G00X1.870A180.469
G00X1.858A181.408
G00X1.847A182.347
G00X1.835A183.286
G00X1.823A184.225
G00X1.812A185.164
G00X1.800A186.103
G00X1.789A187.042
G00X1.777A187.981
G00X1.765A188.920
G00X1.754A189.858
G00X1.742A190.797
G00X1.730A191.736
G00X1.719A192.675
G00X1.707A193.614
G00X1.696A194.553
G00X1.684A195.492
G00X1.672A196.431
G00X1.661A197.370
G00X1.649A198.309
G00X1.637A199.247
G00X1.626A200.186
G00X1.614A201.125
G00X1.603A202.064
G00X1.591A203.003
G00X1.579A203.942
G00X1.568A204.881
G00X1.556A205.820
G00X1.545A206.759
G00X1.533A207.698
G00X1.521A208.636
Regards,

Tom Kerekes
Dynomotion, Inc.

msmart
Posts: 11
Joined: Mon Feb 18, 2019 10:18 pm

Re: G code smoothing-Motor Tuning or Both?

Post by msmart » Thu Feb 28, 2019 6:55 pm

I thought it was really odd for the CAM software generated this code...glad you agree. If MadCAM offers no solution, I may explore an alternative, but I own it, like it's relative simplicity for what I want to do and really like that it is a plug-in to Rhino. I think that the code is probably my problem.

Here's a recent plot after making a few changes you recommended.
Capture 6.PNG
Here's the data for the axis (I believe this is what you were meaning)
4th Axis Data.txt
(607.19 KiB) Downloaded 124 times
And here's the Trajectory planner.
Capture 7.PNG
Let me know what you think.
Thanks!

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

Re: G code smoothing-Motor Tuning or Both?

Post by TomKerekes » Fri Mar 01, 2019 1:06 am

Hi msmart,

As a workaround I just did a global replace of "G00" with "G01F10000" and the file seemed to run pretty well for me. The small in-line rapids are then combined and executed without stops. All the existing G01's all seem to have feedrates of F100 so I think it works ok.

Regarding tuning: That seems pretty good. +/-80 counts of error (80/2000 = 0.04 degrees). But that is at 50 degrees/sec. Probably could be made better if necessary.

Minor note: when capturing plots and data it is best to zero the axis beforehand. The data file only saves 7 significant digits of precision, so plots offset by the tens of millions results in some rounding.

Regarding Trajectory Planner:
Increasing Break angle to 179degrees is usually best for no stops (everything is rounded)
Radius for A Axis of 0 will make feedrates dependent on XYZ only.
Collinear Tolerance seems unnecessarily small
Regards,

Tom Kerekes
Dynomotion, Inc.

msmart
Posts: 11
Joined: Mon Feb 18, 2019 10:18 pm

Re: G code smoothing-Motor Tuning or Both?

Post by msmart » Mon Mar 04, 2019 6:25 pm

Hi Tom-

Thanks for the suggestion as this is a good workaround. It seemed like when I set the radius for A axis to 0, it became unstable and began to oscillate, I did fiddle with some other tuning settings as well, so can't be certain. But I did set it back to 1 and it's running fine.

Mach 3 didn't run it well but Kmotion CNC does, so I'll just use that.

Several years ago I was having problems with coordinated 4 axis in Kmotion CNC, so I started using Mach. But that seems unnecessary now so I think I'll stick with Kmotion CNC. And I might play around with customizing the screen (something I wanted to do before it was available...I'm an artist :D )

Is there a place for people to share different custom screens?

I am still curious if I get any answers from MadCAM, or on the forum...will just wait and see.

As always, thanks for your help!!

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

Re: G code smoothing-Motor Tuning or Both?

Post by TomKerekes » Tue Mar 05, 2019 1:11 am

Hi msmart,
Is there a place for people to share different custom screens?
There is the subforum Custom Screens, KMotionCNC Screen Editor, but it is mostly questions at this point.

There are a few samples included in the Installation under <installation>\PC VC Examples\KMotionCNC\Screens
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply