# 4 Axis CNC MIG welding, weavy stuff problem

31 May 2023 15:39 #272578
I have cobbled together a 4 axis cnc, the XYZC variant (pictures and videos later), with the hope of using siggen and external offsets to do the weaving required during welding, but bumped into some hidden solutions that i can not find, like:
-weaving should be active only while M3 is active
-weaving on a single axis = easy
-weaving on multiple axis = no idea
-weaving on any/multiple axis must be controlled by the angle the torch is turned and based on the direction of travel for G1 only
-Weaving amplitude should be +-2mm for now, frequency is also low at probably 0.5-2Hz
Will add more as i stumble ... hmm progress!

31 May 2023 15:40 - 04 Jun 2023 20:54 #272580
First welding test on some badly rusted material:
Mounted on it's frame in another town/shop:
Last edit: 04 Jun 2023 20:54 by tommylight. Reason: added videos

31 May 2023 15:41 #272581
Reserved for pictures/videos

31 May 2023 18:23 - 31 May 2023 18:50 #272594 by Aciera
Interesting challenge.
Some ideas:
Seems like you could connect the spindle forward signal to the external offset enable pin.
There is also a way to tell if G0 is active or not but I forget how just now.  it's motion.motion-type

It is possible to create a weave on a multi axis motion by combining external offsets on different axes using the scale pins of the respective axis offsets. eg if you want a sine on a 45° xy motion then you would feed 0.7172 x (sine signal) to the x axis offset and -0.7172x(sine signal) to the y axis offset. The scale factors can be calculated from the current trajectory vector.

As a rough idea one might be able to use a component to do the following:
- Calculate the current motion vector from the axis position command.
- Calculate the scale factors for external offsets of x,y,z axes using trigonometry
Last edit: 31 May 2023 18:50 by Aciera.
The following user(s) said Thank You: tommylight

31 May 2023 19:07 #272599
Nice ideas, thank you.
Will have another run through later, need some rest as i was in the hospital with my mom last night, and building a machine with 4 axis in 5 days took it's tool on the gray matter, had to use whatever i could find in the shop, done 4 versions of the C axis and roughly 9 versions of the Z axis, mainly as that C axis is mounted on the Z and needed at least 270 degree motion. Got 300, only limited by weldrers cable, otherwise infinite rotation. Also, needed to hide as much as possible from dust, no one cleans machines aroud here and maintenance is non existant.
All the time thinking of how to go about making it easy for use, not for me, so anything complicated does not go here, lazy people.

31 May 2023 19:21 #272601 by rodw
One thing that Linuxcnc lacks that apparently is present in Mach3  is a heading. Ie the tangential direction of travel in real time.
I did do some work on this once. It entails some pretty deep changes to the interp source and passing the data back to motion as part of the state tags structure then publish additional pins in motion. My interest in this was to obtain the arc radius in real time for plasma control but Andy encouraged me to extend it to calculate the heading (eg so it could be used to orient a tangential knife). Eventually, we came up with other algorithms so I did not complete this work but it did work. It is still available
Lets assume the programmed G2,G3 arcs are in the X,Y plane to describe a possible way forward
A real time component could receive the heading  and use trigonometry to calculate the X & Y components, then apply appropriate external offsets to both axes to  achieve the desired weave about the heading.

Good luck!

31 May 2023 19:25 #272602 by rodw
forgot to mention that I also published the current plane (eg XY,XZ,YZ) which will define the axes to weave. 3D heading eg by a robot arm, would likely need to calculate heading in the kinemetics model.
The following user(s) said Thank You: tommylight

01 Jun 2023 08:41 - 01 Jun 2023 09:26 #272631 by Aciera
I played a bit with getting a 2D weave:

Does not look too bad for continuous paths.   But as usual the problems hide in the details.

One problem is to reset the siggen at the right moment to get the weave centered over the tool path. This also needs to be done in corners. Just resetting the offset to zero might cause joint following errors on closed loop machines.

##### Attachments:
Last edit: 01 Jun 2023 09:26 by Aciera.
The following user(s) said Thank You: tommylight, rodw

01 Jun 2023 15:31 #272639
How?
Another simplification to the issue you mentioned, the welds are always in a straight line on one or both planes, so doing start/stop for each line is also usable. Would also make positioning and rotation on corners easier as the torch can be moved away since the welder would be off.
-
As a side note, i am also building other machines for doing the same thing, currently for doing two welds at the same time on just one plane. Does require more user work to rotate the part, but easier to program and use.
I have a very short time period for this, so the race is on full speed to come up with something useful.
In short, one of the parts is made out of two U shapes to form a square, so there are 8 welds on each square, all straight lines. The other part is simpler as it has a single weld along X and another along Y, but does require rotating the torch to get to the corners.
-
Sorry for the missing pictures. Shame on me.

01 Jun 2023 16:41 - 01 Jun 2023 16:45 #272643 by Aciera
So, I've cobbled a sim config together. Make sure you install the weave.comp first. ie something like this (or with sudo on a deb install)

halcompile --install configs/sim/axis/external_offsets_test/weave.comp

Mind you I don't often write programs so it's all a bit crude and  rough around the edges. But it might be usable. Start the sim config, home and start the example program.

- there is some interaction between feed rate and siggen frequency, if you play around with the frequency using the side panel you can get circle weaves instead of sine.
- I'm sure there are other pitfalls but I have run out of time.

##### Attachments:
Last edit: 01 Jun 2023 16:45 by Aciera. Reason: All kinds of stuff