Threading with G33 - spindle synchronised motion
Let's give threading a go now. This should be considerably simpler on a CNC lathe than hitherto, with all the buggerage involving change gears, gearboxes, leadscrew engagement and cross slide movements at the start and end of the threads. Then there's the issue of cutting my preferred metric threads on an imperial machine ie not disengaging the leadscrew between passes.
The spindle encoder feedback is a key part of the process, although it seems the index signal is the default trigger to the movement. Beyond that, the VFD "spindle at speed" input is used to determine the angular position, on the assumption that the spindle movement is as expected, rather than implement an "electronic gear" coupling between the spindle and Z axis movement.
There's an absolute position signal available from the encoder but it appears I'd need to do more work to implement electronic gearing. One step at a time, fatty. We can get on to that later, once we have the default implementation working.
How G33 works in LinuxCNC:
From the LinuxCNC documentation:
21. G33 Spindle Synchronized Motion
G33 X- Y- Z- K- $-K - distance per revolution
For spindle-synchronized motion in one direction, code G33 X- Y- Z- K- where K gives the distance moved in XYZ for each revolution of the spindle. For instance, if starting at Z=0, G33 Z-1 K.0625 produces a 1 inch motion in Z over 16 revolutions of the spindle. This command might be part of a program to produce a 16TPI thread. Another example in metric, G33 Z-15 K1.5 produces a movement of 15mm while the spindle rotates 10 times for a thread of 1.5mm.
The (optional) $ argument sets which spindle the motion is synchronised to (default is zero). For example G33 Z10 K1 $1 will move the spindle in synchrony with the spindle.N.revs HAL pin value.
Spindle-synchronized motion waits for the spindle index and spindle at speed pins, so multiple passes line up. G33 moves end at the programmed endpoint. G33 could be used to cut tapered threads or a fusee.
All the axis words are optional, except that at least one must be used.
Note: K follows the drive line described by X- Y- Z-. K is not parallel to the Z axis if X or Y endpoints are used for example when cutting tapered threads.
Technical Info
At the beginning of each G33 pass, LinuxCNC uses the spindle speed and the machine acceleration limits to calculate how long it will take Z to accelerate after the index pulse, and determines how many degrees the spindle will rotate during that time. It then adds that angle to the index position and computes the Z position using the corrected spindle angle. That means that Z will reach the correct position just as it finishes accelerating to the proper speed, and can immediately begin cutting a good thread.
HAL Connections
The pin spindle.N.at-speed must be set or driven true for the motion to start. Additionally spindle.N.revs must increase by 1 for each revolution of the spindle and the spindle.N.index-enable pin must be connected to an encoder (or resolver) counter which resets index-enable once per rev.
See the Integrators Manual for more information on spindle synchronized motion.
See G90 & G0 & M2 sections for more information.
It is an error if:
- All axis words are omitted.
- The spindle is not turning when this command is executed
- The requested linear motion exceeds machine velocity limits due to the spindle speed
Which generates the following code. Seems to be generating the expected G33 content:
Air cutting trial:
No comments:
Post a Comment