How to Use Servo Spindle as 'C' axis
- Simpson36
- Offline
- Senior Member
- Posts: 59
- Thank you received: 1
My systems are going to be converted to LinuxCNC and I have everything working except duplicating the Spindle/'C' axis capability of the motion controller used with MACH3.
It works this way for example;
S1000 M3 starts the spindle at 1k RPM
G1 C200 F50 rotates the spindle 200 degrees (relative move)
This happens automatically without any special setup.
I use this for hard tapping and need that functionality before I can put LinuxCNC on the machineS.
The Spindle is set up in LinuxCNC as a servo (step/dir) and that seems to be working fine. I have not figured any way to also have it act as a rotary axis.
How can I set this up?
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
- Posts: 17905
- Thank you received: 4774
I suspect this can be done fairly easily with either some standard hal components
or a custom component.
The way I would approach it would be to run the stepgen in velocity mode
and use a multiplexor to select the stepgens velocity command to come from
the commanded spindle speed or the PID output that closes the spindle position loop
The tricky part is patching the stepgen feedback position (mod turns) when changing to position
(C axis) mode
Please Log in or Create an account to join the conversation.
- Simpson36
- Offline
- Senior Member
- Posts: 59
- Thank you received: 1
Ouch, I assumed this would be easy. I guess not too many people use a servo motor for the spindle.
I understand the concept of what you describe, but the whole PID loop back thing with LinuxCNC is still a little baffling because the loop is not closed back to LinuxCNC, only to the drive, so where is LinuxCNC getting feedback from since it does not see the encoder?
Would it be any simpler to set up an 'fake' axis stepgen for a 'C' axis and swap the outputs? Is it possible to redirect data from one pin to another while LinuxCNC is running?
It occurs to me that with a separate stepgen or 'C', the acceleration could be setup optimal for each application, i.e. soft for use as a spindle and cranked up for coordinated motion.
You mention a multiplexer. Would that be the function in LinuxCNC?
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
- Posts: 17905
- Thank you received: 4774
stepgen position feedback
This has a couple of advantages, one being that you can run a velocity mode stepgen in
position mode without changing the low level stepgen mode.
There are a couple multiplexor HAL components, the most flexible being mux_generic
(man mux_generic for the component manual)
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23560
- Thank you received: 4858
wiki.linuxcnc.org/cgi-bin/wiki.pl?SpindleOrient
In your case things are complicated by it being a step/dir system.
You almost need to add together the steps from the spindle control and the C-axis.
If you are using the parallel port then you can simply use the or2 HAL component between a velocity-mode spindle stepgen and a position-mode C-axis stepgen and the step-output parallel port pin.
Incidentally, LinuxCNC allows rigid-tapping without C-axis control, it slaves the Z axis to the spindle position encoder.
Please Log in or Create an account to join the conversation.
- Simpson36
- Offline
- Senior Member
- Posts: 59
- Thank you received: 1
I have been doing some more searching and I came across the linked thread on this forum. The conversation mentioned my work with a similar need for a 4th axis to serve both high speed spinning and CNC controlled indexing. My 4th axis solution uses external hardware and could be used to accomplish the same function on any servo spindle. It would be an expensive solution for users though.
It is surprising that this capability has not been added as a standard feature of LinuxCNC. It seems to get 'reinvented' over and over with varying degrees of complexity and varying degrees of success. Most of the conversations are above my pay grade at this stage. I am still learning the guts of LinuxCNC. From what I have read, it is unlikely that I have the skill set to accomplish the task at this point.
Nevertheless, somehow I need to resolve this because hard tapping is not the only application. I need to orient the spindles to line up the tool holder drive dogs with an ATC swing arm.
I have a bunch of leftover 'swapaxis' boards from early InTurn™ controllers and their purpose is to take in two signals IN and switch them back and forth to a single OUT using a solid state mux. It just needs a single TTL signal to switch. This is attached to the CNC output so it is downstream of the complicated stuff.
Thanks for the responses and Ideas.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23560
- Thank you received: 4858
It is surprising that this capability has not been added as a standard feature of LinuxCNC.
I can't see how it could be added as a standard feature. Can you explain what you think that would mean?
Nevertheless, somehow I need to resolve this because hard tapping is not the only application. I need to orient the spindles to line up the tool holder drive dogs with an ATC swing arm.
You can do this with M19, but the HAL layer will always be hardware specific.
Please Log in or Create an account to join the conversation.
- Simpson36
- Offline
- Senior Member
- Posts: 59
- Thank you received: 1
I have been 'under the hood' of LinuxCNC/PathPilot for only a few months so I may be harboring some incorrect ideas and please feel free to correct me.
I do not see how 'hardware specific' comes into play when LinuxCNC is sending the same Step/Dir or Analog to any drive, from any manuf. i.e the exact same signals would go to Mitsu, Yaskawa, Alan -Bradley, etc.
What is needed it an awareness that a drive (specifically Step/Dir in this case) can be either a spindle or a 'rotary axis'.
It may be that I am showing over confidence in LinuxCNC, but at this point I have to believe that if Vital systems can accomplish this in their motion controller for Mach3, then certainly LinuxCNC can at least do the same if not significantly more.
The notion that one channel can flip flop using different inputs just flies in the face of my real world experience with this topic because the 'tuning' for a spindle is so drastically different from that of a rotary axis.
My thought, and the result of my solutions as described earlier, is to use two separate channels, separately configurable and tune-able, and switch the OUTPUT to the drive.
Please know that it is not my intention to disparage any attempt at a new capability, but everything I have researched so far has taken the route of changing the INPUT to a single channel and outputting the result to the drive.
While I readily admit that I am no LinuxCNC expert, I probably have more experience at emulating true Mill/Turn on a bench mill than anyone. That experience tells me that you need two independently configurable and tune-able channels and swap the OUTPUT of each to the drive.
I do not have a lot of time to spend on this, so my solution will be tried and true hardware switching of the above mentioned TWO channels, and I already have that set up in LinuxCNC for the current project.
That being said, I am more than happy to collaborate with people much more familiar with LinuxCNC to see if this is doable in software.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23560
- Thank you received: 4858
I do not see how 'hardware specific' comes into play when LinuxCNC is sending the same Step/Dir or Analog to any drive, from any manuf. i.e the exact same signals would go to Mitsu, Yaskawa, Alan -Bradley, etc.
Perhaps I should have said "configuration specific"
LinuxCNC has quite a simple job between the G-code layer and the HAL layer. It's a complicated job to do it correctly, but basically the X-word Y-word etc positions converted to actuator positions are sent to HAL to be interpreted as position commands, as is the spindle speed.
Nothing in that layer really knows anything about the configuration of the machine on the other end.
It seems to me that the appropriate place to combine the spindle command and any specific axis is in the HAL layer where all the necessary information is available, and where a specific configuration can be configured.
What is needed it an awareness that a drive (specifically Step/Dir in this case) can be either a spindle or a 'rotary axis'.
Until you are in the HAL layer the system makes absolutely no distinction between step/dir , analog, digital or any other type of drive.
My thought, and the result of my solutions as described earlier, is to use two separate channels, separately configurable and tune-able, and switch the OUTPUT to the drive.
This is certainly the way that I have always suggested doing it with analogue-controlled servos. I don't know if it helps very much with step/dir servos as the loop with the important tuning difference between the modes is in the servo drive in that case.
I do not have a lot of time to spend on this, so my solution will be tried and true hardware switching of the above mentioned TWO channels, and I already have that set up in LinuxCNC for the current project.
The drawback of this approach is that you are switching in a layer that is unaware of the current axis position, so you will (probably) loose your absolute positioning when switching between spindle and rotary modes. This is why I think the switch should be in HAL, using either the "orient" component ( linuxcnc.org/docs/2.7/html/man/man9/orient.9.html ) or something rather like it.
The neatest place to make the mode-switches for a step/dir system would be in the stepgen itself. That knows it position, and has all the authority and feedback it needs to seamlessly switch between position and velocity. However if it was done there, it would be no help for analogue/PID or digitally controlled systems.
Please Log in or Create an account to join the conversation.
- Simpson36
- Offline
- Senior Member
- Posts: 59
- Thank you received: 1
A potential problem is, again if I understand it correctly, that Orient does not seem to have an axis associated with it. I.e . there seems no mechanism by which g-code could command indexing. ex.(G1 C250 Fxx).
I am still looking for a spindle solution for the long term. My method works very well for Mill/Turn, but has some undesirable behavior for the mill spindle. You are correct in that the registration is lost when switching from what I call 'Turn' mode to 'Index' mode on the 4th axis and this is also the case with the mill spindle. The solution has been home sensors if registering to a specific azimuth or to 'zero' is required. The homing method works very well for the 4th axis, but is problematic with the mill spindle due to the higher speed and smaller diameter available for a sensor. There is overshoot, so the spindle must be brought to some known speed before the sensor can be read.
The speed at which the process completes is not an issue for the 4th axis, but tool change times are extended significantly waiting for the spindle
The 'orient' component looks like it would solve the sensor overshoot problem and be much faster since the registration is known at any speed and would be therefor be immune to overshoot.
I can see in LinuxCNC where the 'count' is being accumulated.
Question: When the 'count' eventually rolls over, is the registration maintained in some way?
Another issue that you raised is that the 'tuning' is within the drive for step/dir which is true, but typically it is used as a MAX to prevent faulting, smoothing transitions and that type of thing. While industrial drives usually have not only configurable, but also switchable gains and other parameters, I think it is more common to have only maximums set at the drive and acceleration controlled by the CNC software.
So then another question arises; assuming some modification of the 'orient' component and therefor switching a stepgen between position and velocity, would acceleration be separately configurable for each mode, or would it need to be read and changed on the fly?
To ask a different way, is there one parameter for a step/gen that would be applied to position and velocity, or are there separate parameters for each?
Thanks for taking time to share your knowledge on LinuxCNC.
Please Log in or Create an account to join the conversation.