Hello Guest it is April 25, 2024, 04:51:12 PM

Author Topic: B C axis independent from XYZ axis  (Read 2547 times)

0 Members and 1 Guest are viewing this topic.

B C axis independent from XYZ axis
« 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!
Re: B C axis independent from XYZ axis
« Reply #1 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
« Last Edit: January 13, 2020, 01:35:34 AM by joeaverage »
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: B C axis independent from XYZ axis
« Reply #2 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!
Re: B C axis independent from XYZ axis
« Reply #3 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
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: B C axis independent from XYZ axis
« Reply #4 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 !
Re: B C axis independent from XYZ axis
« Reply #5 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.
Re: B C axis independent from XYZ axis
« Reply #6 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!
Re: B C axis independent from XYZ axis
« Reply #7 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.
« Last Edit: January 13, 2020, 12:23:03 PM by mcardoso »
Re: B C axis independent from XYZ axis
« Reply #8 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

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

Craig

'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: B C axis independent from XYZ axis
« Reply #9 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!