Dead CNC lathe -> EMC Special purpose machine
- Gregor
- Offline
- New Member
- Posts: 9
- Thank you received: 0
Basically I would like to remove the toolpost and mount a milling spindle, and use the cross slide / main spindle like the Z axis / A axis in the VMC. I've attached a quick sketch in case I'm not explaining this very well!
The lathe has a conventional geared headstock so the control would need to read the spindle encoder and move the X axis in sync, and feed the Z axis at feedrate. In other words, there would be no direct control over the spindle. I could install a spindle drive if necessary, but would prefer not to if possible. Essentially it would be a 2 controlled axis CNC slaved to the spindle.
Can anyone tell me if this is possible/practical with EMC or if I'd need to configure the spindle as a 3rd controlled axis?
Also, the machine has indramat (+-10VDC signal) drives that are in good working order and I was looking at the mesa cards. I'd appreciate any general advice in this area too!
Thanks in advance, Gregor
Please Log in or Create an account to join the conversation.
- BigJohnT
- Offline
- Administrator
- Posts: 7330
- Thank you received: 1176
So your wanting to make cam like objects with a milling cutter on the X axis if I understand you correctly and using the spindle as the A axis. I've not done anything like that but I'm sure someone will chime in that has... I'm pretty sure that is not a problem to do.
John
Please Log in or Create an account to join the conversation.
- cmorley
- Away
- Moderator
- Posts: 7758
- Thank you received: 2043
The other way could be done (rigid tapping is very close to this idea) you would need to add
code to EMC (in C and probably C++) to do it.
how about put the tool in the spindle and use a rotary table on its side?
Please Log in or Create an account to join the conversation.
- Gregor
- Offline
- New Member
- Posts: 9
- Thank you received: 0
I am pretty comfortable with C/C++ so I might be able to manage that.
Alternatively, it probably wouldn't be impossible to add a VFD (would that work, or would it require a servo?) for the spindle motor and configure it as an axis. In the lowest gear (40 rpm) there is very little backlash in the gearbox, and there is already an encoder on the spindle. It would just be a case of removing the clutches.
It would be nice to retain basic 2 axis lathe functionality, but not essential.
Any thoughts or opinions on any of this are most welcome!
Thanks, Gregor
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23537
- Thank you received: 4852
The lathe has a conventional geared headstock so the control would need to read the spindle encoder and move the X axis in sync, and feed the Z axis at feedrate. In other words, there would be no direct control over the spindle. I could install a spindle drive if necessary, but would prefer not to if possible. Essentially it would be a 2 controlled axis CNC slaved to the spindle.
I recall discussing this at some length either on the IRC channel or the mailing list (probably the former).
G33 looks at first glance like it would do what you want, but in fact I don't think it does.
How often do you need to change the profile? That question rather dictates how difficult it is.
If you don't need to load new profiles very often then a HAL component that reads in spindle position and outputs a radial offset to be added to the X-axis position is pretty easy. You would hard-code a lookup table in the component, compile it with "comp" and then wire it up in HAL and that would be pretty much that.
Recompiling the component with a new profile takes a minute or too, but is otherwise not at all onerous.
If you need to be able to change profiles often, and to have unskilled operators do it, then it gets a bit more troublesome. One solution might be a long column of pyvcp spinboxes, each individually net-ed to inputs of a HAL component, with the internal code interpolating between them. I am not sure how many points you need.
It has just occurred to me that, actually, for a simple oval shape, you only actually need one offset, and that could very easily be a pyvcp spinbox, and then all the calculations could possibly be done in HAL. (I was thinking that linear interpolation of radial positions would give a faceted finish, but that is just wrong, isn't it? )
Hal has no trigonometric functions (as far as I can see) , so you would need to make a custom component if you need anything other than linear intepolation, and there is a lot to be said for doing it as a hal component anyway. (you could easily make it automatically disable during homing, for example)
With a fast enough X-axis you could use a conventional turning tool to make the profile.
I want to try this now There is a fair-to-middling chance that the required Hal component will exist by this time tomorrow.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23537
- Thank you received: 4852
Actually a bit sooner. It needs a tweak to pass fb-position back correctly to get following errors detected properly, but I have the cross-slide wiggling in synchrony with the spindle. I think that some cleverness will be needed to handle G0 moves during machining operations though.I want to try this now There is a fair-to-middling chance that the required Hal component will exist by this time tomorrow.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23537
- Thank you received: 4852
This is what the comp looks like:
component oval "Add a spindle-position related offset to an axis for oval turning";
pin in float encoder-pos "encoder position, should be scaled 0-1";
pin in bit disable "set high to disable, for example during homing";
pin in float pos-in "the input (axis position)";
pin in float offset "the required eccentricity";
pin out float pos-out "the modified position request";
pin in float fb-in "position feedback from joint";
pin out float fb-out "position feedback to motion";
function _ ;
license "GPL";
author "Andy Pugh";
;;
FUNCTION(_) {
static float profile[] =
{.500, .624, .741, .842, .922, .976, .999, .991, .952, .885, .794, .684,
.563, .437, .316, .206, .115, .048, .009, .001, .024, .078, .158, .259,
.376, .500, .624, .741, .842, .922, .976, .999, .991, .952, .885, .794,
.684, .563, .437, .316, .206, .115, .048, .009, .001, .024, .078, .158,
.259, .376, .500, .624,} ;
int i;
float f;
if (disable) {
pos_out = pos_in;
fb_out = fb_in;
return;
}
f = (encoder_pos - (int)(encoder_pos))*50.0;
i = f;
f = f-i;
pos_out = pos_in + offset*(profile + f * (profile[i+1]-profile));
fb_out = fb_in - (pos_out - pos_in);
}
Please Log in or Create an account to join the conversation.
- Gregor
- Offline
- New Member
- Posts: 9
- Thank you received: 0
Let me start by saying that I haven't really looked at EMC yet at all, and know VERY little about it.
That said, I do understand what your code is doing (very clever BTW!) and I think it would suit my application very well. Am I correct in assuming that in your test that what we're looking at is a simple G1 Z move? And the X is programmed at nominal diameter with the actual position affected by the coefficients in your lookup table?
If I understand you right, that means that I can program any XZ profile as you would in normal turning, and the HAL component will automatically generate the cross sectional profile? I ask as there are chamfers and fillets at the ends of the elliptical section on the parts I'm making and it would be great if I could program it like a simple turned profile.
Are you doing anything else in your G code?
Being that I know nothing of how EMC works, is it possible to set the disable boolean in your component on the fly via a G or M code so you could switch between normal and elliptical turning in cycle? If that could be done I could look at the possibility of doing like you have in your video with an ordinary turning tool rather than a live tool, and machine the part complete in one cycle (there is a thread on one end an a few other turned features). There may be other factors that would make this approach not viable, servo response, cycle time etc., but it's certainly worth considering and I wouldn't be averse to upgrading the drives and servos if the results would justify it!
My boss has given me the thumbs up, and your experiment has been a huge boost. I'm getting really excited about this project now!
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23537
- Thank you received: 4852
Yes, that is exactly right. It was actually running a loop with a return and an X increment, but in the video it is just a G1 Z-6 that is happening.That said, I do understand what your code is doing (very clever BTW!) and I think it would suit my application very well. Am I correct in assuming that in your test that what we're looking at is a simple G1 Z move? And the X is programmed at nominal diameter with the actual position affected by the coefficients in your lookup table?
Yes. In fact with the component disabled, or with the eccentricity set to zero, the machine acts completely normally.If I understand you right, that means that I can program any XZ profile as you would in normal turning, and the HAL component will automatically generate the cross sectional profile? I ask as there are chamfers and fillets at the ends of the elliptical section on the parts I'm making and it would be great if I could program it like a simple turned profile.
No. The eccentricity pin was connected to a pycvp spinbox control on the axis gui, purely for simplicity. It would be trivial to drive it from an M67 analogue output command, or even to link it to an axis, (you could create an XZU machine, for example) which would allow for blends and tapers.Are you doing anything else in your G code?
Getting even more carried away, with a chain of the components in series you could mix them, blending from a 2 lobe to 3-lobe cam for example…
Again, that would depend on how you set up the HAL file. It was my intention that the disable pin should be connected to the axis.is-homing pin so that the component didn't mess up homing moves. But it could easily be connected to a digital output (M62 - M65) or, in fact, to both with a HAL "OR2" block.Being that I know nothing of how EMC works, is it possible to set the disable boolean in your component on the fly via a G or M code
The component as presented was a proof of concept. It probably really ought to respect axis velocity and accelleration limits, and pass through the real position feedback so that exceeding the speed can trigger a following error.
Please Log in or Create an account to join the conversation.
- Gregor
- Offline
- New Member
- Posts: 9
- Thank you received: 0
Have you tried, or would you mind trying if you have a minute, a profile with a flat section? I'm a little concerned that it will be difficult to produce an actual flat facet like in my sketch. Precise flatness is probably not critical for my application, but it would need to at least look right. What are your thoughts?
Many thanks, Gregor
Please Log in or Create an account to join the conversation.