LinuxCNC Slave Axis

Linux CNC - Plasmac related questions, tips and topics can be posted here
Post Reply
User avatar
FabLab
2 Star Member
2 Star Member
Posts: 65
Joined: Thu Mar 22, 2018 7:46 pm

LinuxCNC Slave Axis

Post by FabLab »

So I am trying to setup LinuxCNC on a gantry style home built machine, and I don't understand how to slave an axis.

After a fair bit of searching google, the only thing I found that seems to be an answer is from here:

https://forum.linuxcnc.org/49-basic-con ... xis-gantry

Is it really that complicated to slave a motor in LinuxCNC?

Thanks!
Rodw
4 Star Member
4 Star Member
Posts: 780
Joined: Sun Aug 21, 2016 1:49 am
Location: Brisbane, Australia
Contact:

Re: LinuxCNC Slave Axis

Post by Rodw »

A six year old thread in the linuxcnc world is pretty much obsolete now as it is continually changing. That thread was written when there was a significant change affecting gantry machines (when version 2.8 was released).

Linuxcnc v 2.8 and above make it realy simple becasue it seperates motors (called joints - 0,1,2,3.....n) from axes (X,Y,Z,A......)
making 2 joints to work together is controlled by homing configuration http://linuxcnc.org/docs/2.9/html/confi ... oming.html and the settings in the ini file. Specifically, the ini file setting HOME_SEQUENCE controls if multiple joints are controlled as one axis.

Becasue a joint axis is set by the homing procedure, home switches on both joints in the axis are mandatory and a home switch must stay triggered until the end of travel.

So we start by ordering the joints 0,1,2,3 in the order they are to be homed. Lets assume these joints are mapped to axes as XYYZ in the configuration.
We want the Z axis to home first to get the torch up out of the road to mimise the chance of damage. Then we've decided that the X axis is homed next. And of course we want the Two Y axis joints to be homed at the same time. So homing will be done in the order of Z,X,(YY)
So therefore, we will set HOME_SEQUENCE in the ini file as follows
Joint 0: HOME_SEQUENCE = 1 # X axis
Joint 1: HOME_SEQUENCE = 2 # Y axis
Joint 2: HOME_SEQUENCE = 2 # Y axis
Joint 3: HOME_SEQUENCE = 0 # Z axis

But additionally, we want the joints on the Y to be homed in a special way becasue they are tied together. All we need to do to tell linuxcnc to home the gantry is to place a negative sign in front of the relevant HOME_SEQUENCE so we end up with:

Code: Select all

Joint 0: HOME_SEQUENCE = 1 # X axis
Joint 1: HOME_SEQUENCE = -2 # Y axis  
Joint 2: HOME_SEQUENCE = -2 # Y axis  
Joint 3: HOME_SEQUENCE = 0 # Z axis
So with home switches installed and the configurations set, attempt to home the machine with hand hovering over estop.
If one of the joint motors is travelling the wrong way and starts to rack the gantry, stop immediately. All you need to do here is to change the sign of the STEP_SCALE setting in the ini file for that joint. Restart and try again, hopefully you nailed it!.

So what happens now is when the gantry homes, the first motor to hit the home switch stops and waits for its mate to catch up befor they both complete homing in unison.

To perfectly square the gantry, we use a HOME_OFFSET in the ini file. If its out of square by 2mm all you need to do is make sure the HOME_OFFSET values are different by 2mm,

The other issue to contend with is the direction of travel at various steps. This is set by setting the various velocities as positive or negative. This is explained in great detail in the link I posted.
User avatar
FabLab
2 Star Member
2 Star Member
Posts: 65
Joined: Thu Mar 22, 2018 7:46 pm

Re: LinuxCNC Slave Axis

Post by FabLab »

I guess I am totally confused, are you saying that the homing configuration is what slaves the axis? there is no config required for the actual (physical) stepper?
When I look in my ini file after running stepconf I don't see anything like your above examples
At this point I am not worried about auto squaring or even homing I would just like to get the gantry to move
Rodw
4 Star Member
4 Star Member
Posts: 780
Joined: Sun Aug 21, 2016 1:49 am
Location: Brisbane, Australia
Contact:

Re: LinuxCNC Slave Axis

Post by Rodw »

FabLab wrote: Sat Apr 15, 2023 10:41 am I guess I am totally confused, are you saying that the homing configuration is what slaves the axis? there is no config required for the actual (physical) stepper?
Yes, stop and read the link I sent. Its the most important piece of documentation that exists.
Stepconf should have built most of what is required. Dont be frightened of editing your config files with a text editor.
But I have never used it.
FabLab wrote: Sat Apr 15, 2023 10:41 am At this point I am not worried about auto squaring or even homing I would just like to get the gantry to move
There are no shortcuts. You can't move a gantry until its homed.
User avatar
FabLab
2 Star Member
2 Star Member
Posts: 65
Joined: Thu Mar 22, 2018 7:46 pm

Re: LinuxCNC Slave Axis

Post by FabLab »

I am not afraid of editing a config file I do it all the time, but in this case I don't understand what to edit.

I have used TinyG Grbl Mach3, Mach4, and MASSO so I am not totally new to CNC configuration I am just struggling with this, I cannot wrap my head around how I home a machine in 3 axis that will only move in 2 :-)

I will take your advice and re-read the homing documentation again & what happens

Thank you very much for the help you have provided!
User avatar
acourtjester
6 Star Elite Contributing Member
6 Star Elite Contributing Member
Posts: 8183
Joined: Sat Jun 02, 2012 6:04 pm
Location: Pensacola, Fla

Re: LinuxCNC Slave Axis

Post by acourtjester »

I had a similar problem getting things setup with LinuxCNC (complete newby) what I do is run the config again and call it something else, or add a number in the title. That way you have the original with your calibration values if needed. I use Pnnconfig, very similar to Stepconfig so this may help. Did you configure all the axis, 4 motors in place of 3. I assume you are slaving 2 motors for one axis, so there is a small check box for selecting the second motor to run reverse to the first.
stepconfig.JPG
stepconfig.JPG (100.92 KiB) Viewed 6639 times
stepconfig.JPG
stepconfig.JPG (100.92 KiB) Viewed 6639 times
DIY 4X4 Plasma/Router Table
Hypertherm PM65 Machine Torch
Drag Knife and Scribe
Miller Mig welder
13" metal lathe
Small Mill
Everlast PowerTig 255 EXT
Rodw
4 Star Member
4 Star Member
Posts: 780
Joined: Sun Aug 21, 2016 1:49 am
Location: Brisbane, Australia
Contact:

Re: LinuxCNC Slave Axis

Post by Rodw »

Pncconf now supports slave axis setup, no need for using an A xis and editing any more. stepconf might to.
User avatar
FabLab
2 Star Member
2 Star Member
Posts: 65
Joined: Thu Mar 22, 2018 7:46 pm

Re: LinuxCNC Slave Axis

Post by FabLab »

acourtjester wrote: Sat Apr 15, 2023 2:28 pm I had a similar problem getting things setup with LinuxCNC (complete newby) what I do is run the config again and call it something else, or add a number in the title. That way you have the original with your calibration values if needed. I use Pnnconfig, very similar to Stepconfig so this may help. Did you configure all the axis, 4 motors in place of 3. I assume you are slaving 2 motors for one axis, so there is a small check box for selecting the second motor to run reverse to the first.
Thanks, I knew about that config option, My problem is not that the slaved stepper is running backwards, its that the slaved stepper doesn't run at all, and so far I have been unable to figure out why
User avatar
FabLab
2 Star Member
2 Star Member
Posts: 65
Joined: Thu Mar 22, 2018 7:46 pm

Re: LinuxCNC Slave Axis

Post by FabLab »

Rodw wrote: Sat Apr 15, 2023 1:09 pm
FabLab wrote: Sat Apr 15, 2023 10:41 am I guess I am totally confused, are you saying that the homing configuration is what slaves the axis? there is no config required for the actual (physical) stepper?
Yes, stop and read the link I sent. Its the most important piece of documentation that exists.
Stepconf should have built most of what is required. Dont be frightened of editing your config files with a text editor.
But I have never used it.
FabLab wrote: Sat Apr 15, 2023 10:41 am At this point I am not worried about auto squaring or even homing I would just like to get the gantry to move
There are no shortcuts. You can't move a gantry until its homed.
Ok maybe I have not been clear enough here, if so I apologize, But I am not having an issue homing a gantry machine.

I cannot get the gantry to move at all, that is because the A stepper will not turn at all under LinuxCNC. The X axis works fine, The Z axis works fine, the Y stepper works fine but of course the gantry gets racked right away because the A stepper does not turn.
This is not a wiring or hardware issue as the machine works just fine using Mach3, Grbl, and TinyG (with ChiliPeppr)

RodW, are you sure about your response from this morning that nothing other than homing config is required to control the A stepper?

I only ask because I have read the info within the link you sent many, many times and that only refers to homing, there is nothing in there about the actual slaving of an axis.

Also when I look in my HAL file there is nothing in it (as far as I can tell) that would control a 4th stepper so I don't understand (still) how configuring only homing drives a stepper since (as far as I can tell) there are no pins configured for that stepper, in short what controls the A stepper at a hardware level within the homing config?

I want to be clear here I am not questing your expertise or knowledge, I am assuming that there is a misunderstanding of my issue. Also I am not trying to shortcut anything, but I don't know how it is possible to home a gantry that wont move.

Now I have been using stepconf for the basic config & choosing xyz as the axis config, I have run it using xyza as well but that option only give you the option to setup the A axis as rotary, so I assumed (possibly incorrectly) that that was not the correct option

At this point it looks to me like it would take a fair amount of HAL file text editing to make a gantry machine work ( I will need to manually create all of the pinouts for the A stepper) Basically copying the Y config and changing the pins for the A stepper. Does that sound correct?

I have to assume I am missing something rather simple since gantry machines are very common and LinuxCNC has been around a long time there has to be a concept regarding LinxCNC that I have just missed...
Rodw
4 Star Member
4 Star Member
Posts: 780
Joined: Sun Aug 21, 2016 1:49 am
Location: Brisbane, Australia
Contact:

Re: LinuxCNC Slave Axis

Post by Rodw »

If your motors move with a XYZA config
In your ini file under the TRAJ section, you should currently have

Code: Select all

[TRAJ]
COORDINATES =  XYZA
Change that to:

Code: Select all

[TRAJ]
COORDINATES =  XYZY
And be sure to set joints 1 and 3 to have HOME_SEQUENCE= -2

Your HAL file will look a bit funny as it will refer to A instead of Y1 but it shouild work becasue that line is what maps joints to axes.

This is my beef with the authors of STEPCONF and PNCCONF who hae continued to follow a XYZA.... naming convention in the created config when things changed. If they used J0,J1,J2,J3.... it would make much more sense. I have been known to manually rename everything this way.....
User avatar
acourtjester
6 Star Elite Contributing Member
6 Star Elite Contributing Member
Posts: 8183
Joined: Sat Jun 02, 2012 6:04 pm
Location: Pensacola, Fla

Re: LinuxCNC Slave Axis

Post by acourtjester »

I have seen where others have just wired the second motor to the same driver with the dir wires reversed for the slave motor, 2 motors one driver.
The table configuration I use I only have 3 motors no slaves, so I have not had to deal with a slave motor.
DIY 4X4 Plasma/Router Table
Hypertherm PM65 Machine Torch
Drag Knife and Scribe
Miller Mig welder
13" metal lathe
Small Mill
Everlast PowerTig 255 EXT
User avatar
FabLab
2 Star Member
2 Star Member
Posts: 65
Joined: Thu Mar 22, 2018 7:46 pm

Re: LinuxCNC Slave Axis

Post by FabLab »

acourtjester wrote: Sun Apr 16, 2023 12:17 pm I have seen where others have just wired the second motor to the same driver with the dir wires reversed for the slave motor, 2 motors one driver.
The table configuration I use I only have 3 motors no slaves, so I have not had to deal with a slave motor.
To be honest I was almost to that point!!

But I did finally manage to get it working, I have to say I found it more difficult than I thought it would be, it was definitely more difficult than any other control software I have used. There is quite a bit of editing of both the ini and hal files in order to get it working.

It does sound like Ver. 2.9 has an option for gantry configs built in to both stepconf and pncconf so it should be easier in the future.

Thanks to everyone for the help!!!
Rodw
4 Star Member
4 Star Member
Posts: 780
Joined: Sun Aug 21, 2016 1:49 am
Location: Brisbane, Australia
Contact:

Re: LinuxCNC Slave Axis

Post by Rodw »

It gets easier!

Stepconf and pncconf are really just a crutch to get you going. Then throw the training wheels off and hand edit your files is by far the best way!
They are useful to get a basic working config.

The bad news is for plasma you really need to be using V 2.9 to get access to the QTplasmac config but for a parallel port config, the latency may increase which is not good for software stepping. Most people use a Mesa 7i96s and a Mesa THCAD2
Here is my shortcut to install Linuxcnc Bookworm which includes Linuxcnc v 2.9 in its repositories.
https://docs.google.com/document/d/1jeV ... sp=sharing
Post Reply

Return to “Linux CNC - Plasmac”