G code challenge - velocity ramp in EMC machine

More
14 Mar 2014 00:55 #44767 by HollyGates
Hi there, I have a G Code challenge.

A few years ago I built a spray coating machine using EMC for the controller. Its been kicking along pretty well, mostly without any issues. Various engineers use it for spraying a variety of materials. The motion is XY cartesian, and it just runs a straight up raster pattern. People change the feed speed, and the X and Y pattern sizes.

One user asked me if I could figure out how to run the motion faster in the center of a pass. I'm going to try to attach a graph of an example profile in velocity.

Is there a simple way to do this in G code?

Originally, the G code for the pass might be:
G1 X250 F20000

What I would like instead is:
G1 X50 F20000
-> gradually reduce velocity from 20K to 10K while travelling to X100
G1 X150 F10000
-> gradually increase velocity from 10K to 20K while travelling to X200
G1 X250 F20000


The accel and decel at the beginning and ends are just the axis maximum settings, which I put in using Stepconf during setup. What I want could be achieved by changing the axis max accel setting during the pass, but I don't think there is a way to do that in G code. The transitions in V between the straight and ramp part don't have to be sharp or precise. I thought of two potential approaches:

1) write a program which strung together lots of little moves with gradually increasing or decreasing F values. Flip the G code switch which blends together paths.

2) use a fake Z axis (which doesn't exist on the machine). Set the Z axis max accel to some TBD value, then use a combo of arc and straight line moves including a z coordinate for the sections where I want to change X velocity over the course of the move. Haven't fully thought through exactly how this would work, but it seems like it should be doable. Something like this:

G1 X50 F20000
G18
G3 X50 Z60 I50 K25
G1 X150 Z110
G2 X150 Z50 I50 K25
G1 X250 F20000


Anyone have any guidance on this? Maybe there is some easy way to do it using straight up G code and I am too dense to think of it...

Thanks for any help,
-Holly
Attachments:

Please Log in or Create an account to join the conversation.

More
14 Mar 2014 01:35 #44773 by andypugh

Is there a simple way to do this in G code?

No, unfortunately not. Someone had a similar situation wanting to make a ball suspended from 4 wires follow a convincing trajectory.

I think that your fake-Z might work. (and it is quite clever).

Another way might be to use the adaptive feed input and the lincurve HAL component.
www.linuxcnc.org/docs/devel/html/man/man9/lincurve.9.html
(It is only currently available in Master but can be easily installed in any version of LinuxCNC.

If the input was connected to X position and the output was connected to adaptive feed, then you could define the velocities as (X,Y) points and the component will linearly interpolate between them.
loadrt lincurve count=1 personality=8
setp lincurve.0.x-val-00 0
setp lincurve.0.x-val-01 10
setp lincurve.0.x-val-02 50
setp lincurve.0.x-val-03 100
setp lincurve.0.x-val-04 150
setp lincurve.0.x-val-05 200
setp lincurve.0.x-val-06 240
setp lincurve.0.x-val-07 250

setp lincurve.0.y-val-00 0.5
setp lincurve.0.y-val-01 1
setp lincurve.0.y-val-02 1
setp lincurve.0.y-val-03 0.5
setp lincurve.0.y-val-04 0.5
setp lincurve.0.y-val-05 1
setp lincurve.0.y-val-06 1
setp lincurve.0.y-val-07 0.5

net lin-in lincurve.0.in <= axis.0.motor-position-cmd
net lin-out lincurve.0.out => motion.adaptive-feed

Should give you the same profile as the graph.
The following user(s) said Thank You: HollyGates

Please Log in or Create an account to join the conversation.

Time to create page: 0.102 seconds
Powered by Kunena Forum