Hello Guest it is March 28, 2024, 05:04:53 PM

Author Topic: CNC movements not smooth  (Read 5342 times)

0 Members and 1 Guest are viewing this topic.

CNC movements not smooth
« on: July 11, 2016, 02:24:21 PM »
Hi,

Lately, I have been developing a laser engraving process which let me paint a picture on a piece of wood or other material. Everything related with the laser is fine and I am having a great time experimenting with it.
Originally I bought the PicEngrave 5 Pro software to generate my G-Code but I quickly moved on to programming my own software. So far, the software is great and I am having a lot of fun.

The software generates a list of lines (G01 X Y) and I am using the Speed control to vary the intensity of the laser and thus change the color of each line. This allows me to effectively create some nice greyscale engraving. So far, so good.

The problem I am having is the fact that the CNC stops for a brief moment right between two G01 calls. This introduce significant delays in the process because of the large quantity of G01 calls I am making.

I have set my motors to do a very high acceleration/deceleration before/after movements in the hope that it would fix the issue. It helped but the small delay between two G01 calls seems to be introduced by Mach4 itself.
I also tried using Constant Velocity (CV) versus Exact Stops but it didn't help.

I would like my CNC to make very fluent movement and not to pause for a brief moment betwen two G01 calls.
I have attached a copy of a typical G-Code I would run on my laser engraver, you will see the large amount of G01 calls.

Any idea what could fix my problem? I have not tried to use Mach3 to do the same job since I dont want to spend time setting it up.

This is my setup:
Mach4 2872 -> ESS (Old plugin) -> G540 -> NEMA 23 (30 Kg*cm)

Thanks,

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: CNC movements not smooth
« Reply #1 on: August 18, 2016, 12:12:48 AM »
The issue is all of the G01 lines are separated with S lines.  S breaks the CV chain.  In fact, M, S, and T will all break the CV chain.  In a Fanuc control, they refer to it as MST.

If you think about it, the look ahead would basically set S to the last value it read even when the machine is actually running the FIRST line of G01 code.  So we MUST break the CV chain and WAIT on that G01 line to run before advancing to the next S line.  Then, you will have spindle speed ramp times in there too.  You can probably set them to zero and alleviate that.  But nothing will keep it from going into exact stop mode for the S word.

Steve
Re: CNC movements not smooth
« Reply #2 on: August 18, 2016, 01:15:37 PM »
Thanks a lot for you reply, you enlightened me.

So, if I understand correctly, changing the PWM output using an S code or even the state of an output using M11/M10 will break the continuous velocity mode and will force to wait between each movements?
I understand that this is required because, else, some S or M calls could be executed while the machine is not at the right position due to the look ahead.

Then, would it be possible to spawn a new independent process that would look at the current position of the machine and send commands to activate or deactivate and output in function of the position. We could pre-calculate all the positions at which an output needs to be enable or disabled and then this independant process would take care of doing it. Do you think we could do using the embedded LUA interpreter? Would something very similar to an infinite loop create problems with the G-Code interpretation? I think that the embedded LUA instance does not support multi-threading and thus, every other LUA part (the UI for example) would be jammed until our LUA loop finishes.

I know the concept is feasible in theory since other laser control programs are able to do it.

Thanks a lot for your time,

Phil

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: CNC movements not smooth
« Reply #3 on: August 18, 2016, 02:54:18 PM »
It is M62/M63 in Mach 4.  And the motion controller you are using has to support it.  They are special M codes that are an exception to the rule of M codes breaking the CV chain.  I'm not sure if ESS supports them yet or not.  :(  And they also only operate outputs, not some analog value.  So you would have to vary the PWM output based on which output was selected.  maybe 10 outputs to span the range of the PWM?

There is a LUA instance that runs the PLC script.  It basically gets executed at a predefined interval.  That is where I would do any code like what you are talking about. 

Steve

Offline Pedio

*
  •  200 200
    • View Profile
Re: CNC movements not smooth
« Reply #4 on: August 19, 2016, 09:29:28 AM »
Phil,

I assume you have your Mach 4 set to constant velocity and not exact stop. I am using a laser on M4 and don't appear to be seeing the same problem. I generally use it for art work where I fill in areas with hatch or solids so there are LOTS of lines to be drawn. The Gcode files get very big even for little pieces. In order to get a dark fill with the laser the lines are separated by .005" so it takes a lot of them to make a fill.

Are you turning off your laser between the moves? If not there should be a small black dot where the machine stops. I have really been able to get some remarkable pieces out of M4. I use Vcarve Pro as my CAD/CAM. I had to write a new post processor to get everything to work correctly.

Offline Pedio

*
  •  200 200
    • View Profile
Re: CNC movements not smooth
« Reply #5 on: August 19, 2016, 09:32:58 AM »
BTW - I am using a PMDX motion controller board. You may want to check with your motion controller to see if there are any settings that may cause this problem.
Re: CNC movements not smooth
« Reply #6 on: August 19, 2016, 10:09:04 AM »
Pedio,

This is really interesting. I am also using Vcarve Pro as one of my tools. Could you attach your post-processor to your post? Also could you attach an example of the G-Code file that results from your CAM?

I will see if its a Mach4 issue or an ESS issue.

Thanks,

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: CNC movements not smooth
« Reply #7 on: August 19, 2016, 01:37:15 PM »
Just to be clear, the S word separating the G01 moves IS the problem here.  If you take out all of the S words, you will see it run very gracefully in CV mode. 

Steve
Re: CNC movements not smooth
« Reply #8 on: August 19, 2016, 01:54:40 PM »
Yeah, I think Pedio uses M03 and M05 between his G01 . Is M03 and M05 in the list of non-blocking M-codes? It would explain it.

Thanks,

Phil

Offline Pedio

*
  •  200 200
    • View Profile
Re: CNC movements not smooth
« Reply #9 on: August 19, 2016, 02:30:27 PM »
I do use the spindle control for turning on and off my laser. It works pretty well with Vcarve Pro. You can see how I do it in the post processor for Vcarve.

Attached is the post processor for Vcarve. You need to change the file extension back to .pp from .txt

I also attached a file for a humming bird.

Let me know how it works