Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: DanielS on January 12, 2020, 11:38:41 AM

Title: B C axis independent from XYZ axis
Post by: DanielS on January 12, 2020, 11:38:41 AM
Hello
Does anyone have any idea how to separate the axes (move independently) B and C from the XYZ axes.
Can be done in LUA?
Has anyone tried so far to separate the axes ?
Thanks!
Title: Re: B C axis independent from XYZ axis
Post by: joeaverage on January 13, 2020, 01:29:53 AM
Hi,
can you explain a bit more about what you mean.

In Mach4 there are six independent axes X,Y,Z,A,B, C any of which can be moved independently of the others,
or any combination of them can be moved in coordinated fashion, sometimes call interpolated movement.
Interpolation seems a bit weird when you mix linear and rotational axes...but I suppose its not inappropriate.

I am guessing that you have come from a Mach3 background. In Mach3 it was common to slave the A axis say,
to the X axis say, and thereafter they would move together as a master/slave pair.

Mach4 is markedly different. If your thinking along the lines of Mach3 and slaved axes you need to unlearn that.
(Large quantities of  whiskey aid my forgetting of things!!!)

If you require a slave to the X axis motor, in Mach4 you may assign up to five slaves to the X axis motor on the
Axis Mapping tab of the Control plugin page per attached.

Even more importantly and flexibly you can by Lua script link and unlink the slave/slaves from the master at will.
There are a few quirks as to how and when changes made to the linked/un-linked status of any given slave motor
is flushed to the .ini file. Lets not go down that rabbit hole for the moment. These are from the API.chm file
(Mach4 Docs):

Code: [Select]
rc = mc.mcAxisMapMotor(
number mInst,
number axisId,
number motorId)

Description:
Map a motor to an axis.

rc = mc.mcAxisUnmapMotor(
number mInst,
number axisId,
number motor)

Description:
Unmap the motor from the axis.


For instance if you have a slave motor on your gantry they would in normal operation be slaved together. What happens if the
gantry gets out-of-square? With the two APIs you can drive to the master home switch of that axis, then unlink the slave
form the master and then 'jiggle' the slave motor back and forth until the secondary home switch ( or gantry squaring switch)
is activated, then you can link the slave back to the master, and all of this can be done in a script, maybe at the push of
a button of your design.

Mach4 is most marvelously flexible once you get into it.

Craig
Title: Re: B C axis independent from XYZ axis
Post by: DanielS on January 13, 2020, 03:14:47 AM
Hi
Joeaverage

I apologize for the confusion created.
It's not about the slave axis.
In short, I would like that when I want to move the B or C axis together with the XYZ axes in the same program line (Ex: B100 X200) the B axis should not be delayed by the X axis, to reach 100 before the X axis, not at the same time as now.
Thanks!
Title: Re: B C axis independent from XYZ axis
Post by: joeaverage on January 13, 2020, 05:23:12 AM
Hi,

OK, so its not about slave axes.

Quote
I want to move the B or C axis together with the XYZ axes in the same program line (Ex: B100 X200) the B axis should not be delayed by the X axis, to reach 100 before the X axis, not at the same time as now.

That is not a coordinated move. For example if you code:

g0 x100 b270

then the x axis move occurs synchronously with the b axis move and they complete at the same time. This is normal.

I you wish the B axis to move BUT NOT SYNCHRONOUSLY then it is not a b axis any more, its an 'out-of-band' axis,
shortened to OB in Mach4. The spindle is an example of an OB axis, it rotates but not synchronously with any other axis.

If you wish to have a b or c axis move at some defined rate or distance and then have a coordinated axis move simultaneously
but not synchronously then you must re-define the b or c axis motors as OB axes. Then you use the jogging APIs:

Code: [Select]
LUA Syntax:
rc = mc.mcJogIncStart(
number mInst,
number axisId,
number dist)

Description:
Start an Incermetnal jog move.

rc = mc.mcJogSetRate(
number mInst,
number axisId,
number percent)

Description:
Set the jog rate of the given axis as a percentage of the axis' maximum velocity

rc = mc.mcJogVelocityStart(
number mInst,
number axisId,
number dir);

Description:
Start a velocity jog on the given axis.

Note these APIs are required to be enacted by a macro. The macro should start the jog then return (while the jog is
still moving) and then regular Gcode moves on the remaining coordinated axes will have the desired result.

Craig
Title: Re: B C axis independent from XYZ axis
Post by: DanielS on January 13, 2020, 06:05:26 AM
Hi Craig
I understand the idea with the OB axes.
My problem is that the B and C axes have to be synchronized.
If I use the OB axes I will not have synchronization between the two?!
Or I will have synchronization ???
Thanks !
Title: Re: B C axis independent from XYZ axis
Post by: mcardoso on January 13, 2020, 09:28:28 AM
Out of Band = No synchronization.

If you wish to do the move you described XYZAB start -> AB stop -> XZY Stop... You would need to program that as two lines with CV turned on. The first move would get you part way through the move on XYZ and finish the motion for AB, the second line of Gcode would finish the motion for XYZ.

For Example, if you wanted to move XYZ to 10 units and AB to 6 units.

G1 G90 X6 Y6 Z6 A6 B6 F20
X10 Y10 Z10 F20

If you needed some axes to move faster than eachother while doing these moves, then you're going to need to do some math to figure out the component velocities of each axis in the move and adjust accordingly. This is what your CAM package should be doing.

This isn't a limitation of Mach in any way, just the way Gcode behaves.
Title: Re: B C axis independent from XYZ axis
Post by: DanielS on January 13, 2020, 11:38:10 AM
Hi
This helps me a bit but I still have a problem when I have processing on both spindles.
However, it is a good idea!
This helps me positioning the spindle but not when turning on the second spindle.
The A and B axes should work synchronously but independently of XYZ.
Thanks!
Title: Re: B C axis independent from XYZ axis
Post by: mcardoso on January 13, 2020, 12:19:46 PM
You might be referring to independent planners/coordinate systems. This would allow completely separate control of XYZ and AB, but allow XYZ to be coordinated and AB to be coordinated separately.

Mach 4 only supports a single planner / coordinate system at the hobby and industrial levels, however there have been hints of other versions which support more.

This type of control is common on Swiss Lathes where there is work being performed independently on the front and rear spindles, only to work together with special sync codes. This is actually pretty complicated for a CNC control to do, even in high end controllers, and isn't something that Mach 4 can do out of the box without some special effort.
Title: Re: B C axis independent from XYZ axis
Post by: joeaverage on January 13, 2020, 01:27:00 PM
Hi,
there was a thread about this a while back:

https://www.machsupport.com/forum/index.php?topic=42179.msg274870#msg274870 (https://www.machsupport.com/forum/index.php?topic=42179.msg274870#msg274870)

but then....you would know, you started that thread too??

Craig

Title: Re: B C axis independent from XYZ axis
Post by: mcardoso on January 13, 2020, 01:41:57 PM
Whoops! And I commented on that thread  ;D

I didn't look to see who was posting!
Title: Re: B C axis independent from XYZ axis
Post by: KatzYaakov on January 13, 2020, 07:14:46 PM
only 2 computers
i also use like that ,we have cnc with labeing as station before the cnc
the labeling have 2 axiss while cnc have 5
they work in depended but we have external application that control both and give the command for each pc what to do
Title: Re: B C axis independent from XYZ axis
Post by: DanielS on January 14, 2020, 03:57:56 AM
I apologize for starting another thread, but I try to solve the problems one at a time.
The problem with the tool change is 90% solved, so I thought it was ok to open another thread with the second and largest problem.
I apologize again for the inconvenience created.
I was wondering if it would work by opening two mach4 screens, each with its own code and different control boards.
I know it is "impossible" at the moment, but it was an idea.
Citizen has dual control, but in fact it is a single PC, it has one board on which it's also the PC and the NC .
A single code is created which will be later divided into separate windows by $ 1 and $ 2.
Title: Re: B C axis independent from XYZ axis
Post by: joeaverage on January 14, 2020, 04:10:07 AM
Hi,

Quote
I apologize for starting another thread, but I try to solve the problems one at a time

I don't really car how many threads you start....its just they will all end the same way.

There is one solution....use two PCs with an external C# program to synchronise them per Katz Yakov's solution.
The other is to hassle smurph into selling you Mach4Expert which can handle multiple threads.

Craig
Title: Re: B C axis independent from XYZ axis
Post by: DanielS on January 14, 2020, 05:55:55 AM
I agree with that solution and asked for details on how the final screen will look, or the screens, if the units need to be exactly the same, etc. but I did not receive any response from KatzYaakov. :-[
I want to know more details because I want to see how well it can be implemented on my machine.
I am willing to pay for the application and help with its implementation.
Thanks!
Title: Re: B C axis independent from XYZ axis
Post by: KatzYaakov on January 15, 2020, 06:30:54 AM
hi sory just today i back from china (install the mach +pokeys on our machine)
you can think about 2 seprate mach4 system
then on one pc (lets call it master) you create application (i use c# but you can any language that suport mach api)
that application you create the interface as you want,i for example create list of programs that will run one by one automatic ,this application run the mach in the master with simple mach api
and the mach on slave  ,i use 2 step ,first copy the files that i want to the slave,second run application on slave that run the neded program
i use to communicate 2 pc with ssh communication program(my daughter care for that  if you will need she can help you)
and one of main point i try to do that user no need switch between 2 pcs only see one interface
hope thsat gave you first view how its build
Title: Re: B C axis independent from XYZ axis
Post by: DanielS on January 16, 2020, 04:32:35 AM
Hi
Tell me if I understood correctly:
There will be only one screen, the Mach 4 screen!?
The program for both units will be uploaded to the master unit, and through the C # code and SSH communication it will be transferred to the slave unit!?
Then, through the C # code, both units (G code) will start at the same time and when the code asks for it they will synchronize!?
It is correct as I understood, or ....!???
Thanks!
Title: Re: B C axis independent from XYZ axis
Post by: KatzYaakov on January 16, 2020, 10:36:44 AM
90%
The main screen (user interface) its not mach its c# app interface
Title: Re: B C axis independent from XYZ axis
Post by: KatzYaakov on January 16, 2020, 10:38:52 AM
And the syncronise i dont know if its 100%,i mean if you want the 2 mach system axiss csn fo interpolation ,i think no
Title: Re: B C axis independent from XYZ axis
Post by: DanielS on January 16, 2020, 10:56:30 AM
Hi
There will be times when the B axis spindle 2 will have to mirror the Z axis spindle 1 movements.
For example when the piece is taken over by Sp.2 from Sp.1 and required to make and chamfer.
If this movement is not done in real time then the axes will pull each other the result will be probably a servo alarm.
Thanks for explaining the process and for your patience.
Title: Re: B C axis independent from XYZ axis
Post by: KatzYaakov on January 17, 2020, 12:59:33 AM
i can think about solution like connect that servo motor to both system,because its step/dir i think no problem, but this will need for you some challenge
like how tell the system that didn't move now the motor where is the new position after other system move it
and electrics connection to avoid signal from one system float into other system
i think both can have not complicated solution