Arcs on 4th axis machine in XA plane / axis scaling during gcode processing

More
24 Dec 2021 21:54 - 24 Dec 2021 23:46 #229927 by Matt Hat
  Hello, I would like to ask for advice on setting up a 4-axis and/or 3+1 milling machine with a standard xyz setup plus an rotary A axis to turn the part about the X axis, similar as a standard lath would do it. This machine is meant to engrave text on rotary parts like an conventional plotter for line drawings would do.

I am having some issues to:
- enable arcs in the XA plane, since G2 and G3 seem not to support a selection of the XA plane
- setting up proper feedrates for joint moves of X and A axis. Maybe experts call this 4-axis motion, since both axis need to move simultaneously. However, either I will use X,Y, and Z, or X, A, and Z, making it 3-axis machining in different configurations. It is not intended to run Y and A axis simultaneously (that would require some trajectory planning).

I could figure out some workarounds:
- Use of G93 inverse time mode allows me to run tilted straight lines in the XA plane.
- For engraving tasks, I could use a standard XYZ setup, ignore my physical Y-Axis, and route the SW Y-Axis to the physical A-Axis. Then I could config my rotary axis in mm and mm/s, instead of using rotation angle and revolutions per min. This obviously works for fixed diameter parts; every different diameter will need dedicated configuration for the axis pitch, speed, limits etc. Nice is, that arcs with G2 and G3 would works without issues, since everything will just be in the XY plane. Circle will be circles and not ellipses.

Some initial ideas without a clear plan how to implement such features:
 - Using a scaling factor, that converts Y-Axis motion to A-Axis rotation, with the scaling factor being set prior to g-code generation and using the XYZA axis config. The scaling factor would be angle/height := height2angle = 360/(rodDiameterbe*Pi), angle = height2angle * height. Lines on a XY drawing would call joint moves of the X and A axis.
- The scaling brings some complexity: Any circle will be converted to a ellipse, requiring interpolation to be done prior to sending the gcode to the machine, or using some complex conversion to splines. In this setup, the A-Axis will use degree for angular rotation, and x mm for translation movements.

 - Using a scaling factor, that converts A-Axis rotation to a Y-Axis motion, with the scaling factor being set from the g-code file. This way engraving jobs on different diameter rods could be combined in one machine profile, requiring only the scaling factor to be reset. The scaling factor would be height/angle := angle2height = (rodDiameterbe*Pi)/360, height = angle2height * angle. This would be my preferred path to follow, since any circle or arc will not require to run elliptical features.

- Any ideas how to scale an axis from a running gcode  (and not by entries in .ini or .hal ) ?
- Any resources/macros available to run elliptical interpolation on the machine? I would need to convert G2 and G3 commands because the radius of a circle along U will be different than along X, because of the rotational movement of the part (mocking an plotter drum) and the different units (degree along rotation A, mm along x). I saw a subroutine in the example section, but I would still need to convert any G2 or G3 line to a subroutine call figuring out the proper parameters invoked.
- Any advice on post/processing chain is welcome. I do not really understand why a simple G-command for elliptical traces does not exists and I am not experienced and motivated enough to setup a full kinematics module. It would be lovely to have G2 and G3 not reporting any error like "radius mismatch, i.e. distance of arc center to start point differs from distance of arc center to end point". I think in 2022 it should be possible to cut a ellipse like any circle from a one-line command.

Context: need the A-Axis for simple tasks, such as turning a milling part for front and back operations, cutting some square or hexagon features on custom bolts screws to a raw shape (doing threading manually or on a lath), and, do some engraving on rods along the rotation axis.

Thanks for any inputs!
 
Attachments:
Last edit: 24 Dec 2021 23:46 by Matt Hat. Reason: Question added. Renaming 4th Axis as A-axis.

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

More
25 Dec 2021 00:27 #229939 by rodw
You could consider using external offsets where a pin received the diameter or radius and offset the Z according to your formula. 
You could send the required parameters using M67/M68  and enable the feature using the M62-M65.
Otherwise invest in a good postprocessor :)

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

More
25 Dec 2021 12:43 #229957 by andypugh
I would say that using the U axis for the rotary might not be ideal. Partly because the lookahead / blending of the trajectory planner does not include the U axis.

I might need to do this myself fairly soon, so I have given it some thought.

One option would be to create an XYZAV configuration using a custom kinematics. (not a complex one) 

This would move the rotary joint according to Y * pi * Z + A (so you can use the A axis to position around the circumference) and would use the V axis to position the cutter in the conventional Y axis. 

Then engraving can be done using conventional XY movements. 

I would probably do this by creating a specific configuration for rotary engraving, sharing the config folder with the other setups. My mill already has one config folder containing 4 INI files, for normal vertical milling, horizontal milling (changes the joint/axis mapping only), gear hobbing and a synthetic 5-axis configuration with a manual B axis.
These all share a tool table and things like the spindle control HAL file, but other HAL files contain the differences. 

For extra usefulness you would maybe want to add Z-mapping. (I expect to need to do so as I will be engraving shaped tankards) 
 
The following user(s) said Thank You: tommylight, Matt Hat

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

More
29 Dec 2021 10:43 #230208 by Matt Hat
Great advice! I like that approach. We would like to send G1,G2,G3,G5 to do operations in the XY plane and let the machine translate that to the physical motion.

I am actually interested in all useful configuration of such a 4-axis machine:
- XYZ+A with manual A axis to flip the parts --> default XYZA config is fine

- True 4-axis control with full kinematics: not something to start with, but with awesome potential for future work incl. trajectory planning.

- A XZ+A lath setup with position control in A to cut threads:
Having a high torque stepper to synchronize the angle with Z, this could be done in XYZ+A config using G93 inverse timing and a G1 Z(N*pitch) A(N rotations). A normal lath, I guess, does not provide synchronous motion of X and Z? I prefer setups with steppers instead of fiddling with speed controlled spindles. Also, the stepper torque is awesome for threading and still runs up to 20 Hz = 1200 rpm, giving it some time to accelerate to max speed.

- XYZAV to engrave on rotary parts, simple kinematics to convert from XY to XA as proposed by Andy,
for varying diameters (miller at z=R, z=0 on rotation axis),
                          using Z position as parameter for the rod radius,

   (position on circumference in mm) = (Radius in mm)*(angle in Rad),
   transforming Y (in mm) from G code to Y' as position on circumference in mm
                 Y' = Z*(angle in Rad) = Z*(pi/180)*(angle in degree) = Z*(pi/180)*Y,
   where Y is now a rotation coordinate in degree, accepting G2, G3, and G5 commands.

The origin Y=0 in G-code is mapped to physical A=0, either rotating the part manually with G1 Axx and commit a G92 Y0, or as proposed by Andy
                   Y' = Z*(angle in Rad) + A (origin) = Z*(pi/180)*(angle in degree) + A = Z*(pi/180)*Y + A

That looks simple but for me - still a newbie with no experience in HAL files and the kinematics module, still tricky enough.
--> If you can share your config files, that would be greatly appreciated!
      I helps a lot to start with an already tested and running config and work further from that.

Maybe I can work back from: wiki.linuxcnc.org/cgi-bin/wiki.pl?Rot4thaxiskins ?

I did not yet have time to look into tool compensation. Seems to be very helpful though. Also I need to learn use of G commands other than G0, G1, G2, and G3.

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

Time to create page: 0.095 seconds
Powered by Kunena Forum