Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: rufustoad on December 31, 2021, 08:32:39 PM

Title: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: rufustoad on December 31, 2021, 08:32:39 PM
Can anyone tell me why Z will not go to work zero when required? Also why does the error AXIS 3 commanded while disabled keep coming up and when you enable it I get a Axis mapping error? This is a slave axis and shouldn't be enabled?? I am NOT a computer programmer. 

What does this mean

-- Go To Work Zero() function.
---------------------------------------------------------------
function GoToWorkZero()
    mc.mcCntlMdiExecute(inst, "G00 X0 Y0 A0")--Without Z moves
    --mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0 A0\nG00 Z0")--With Z moves
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: thosj on January 01, 2022, 08:33:43 AM
I don't know about the first part, but the last part explains why your Z is not going there!!

That is LUA, and you have to comment out the first line, add --, and remove the comment -- from the second line. Kind just like it says there!!

Axis 3 is likely not enabled unless you have some sort of third axis. If Axis 3 is a slave, it should move with it's main axis. If Axis 3 is A, likely, try removing the commanded A0 in the Go To Work Zero line you just commented/uncommented!!! It should look like this:

mc.mcCntlMdiExecute(inst, G00 G53 Z0\nG00 X0 Y0\nG00 Z0")--With Z moves   NO A0.

That line, BTW, moves Z to HOME, UP to the top typically, moves X and Y, then Moves Z back to it's Work Zero spot, so you don't hit something!!

Tom

Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: rufustoad on January 01, 2022, 12:40:39 PM
Thank you very much for that assistance, Tom. My next question would be how to edit that script? I have tried to change that, but it doesn't allow it and I cannot seem to find this in the script editor.
I apologize but I am far from a programmer and would never have purchased 4 had I known I would have needed to be. Very frustrating with all the code needed to be changed and far from "Hobby" program.
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: rufustoad on January 01, 2022, 01:20:59 PM
I just wanted to add you were right on with that script after I did a ton more searching just need to learn how to change it. >:(
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: SwiftyJ on January 01, 2022, 02:04:09 PM
Here is a video on the Machsupport youtube channel of modifying the go to zero script. It is a bit out of date as it still uses the old lua editor but shows you how to go into the Screen Load script and edit the function.

https://www.youtube.com/watch?v=SZuEJn046Pw

Also, I don't think many people here are 'programmers', if you put a bit of time into learning where things are within the editor and try to learn some of the basic commands, Mach4 is fairly easy to customise. If you can follow the video above then you are already on the way there!
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: rufustoad on January 01, 2022, 02:24:40 PM
Swifty J THANKYOU THAKYOU THANKYOU!!! I have literally spent hours trying to find that video. It just gets a bit frustrating spending so much time on this when Mach3 was ten times more user friendly. This IMO is far from a Hobbyist app.
One more question if I may, is there a video your aware of that shows how to reverse A axis and take it away from being a Y slave? I want to make it home every time I ref all and I don't see another way to do this except to put it back on its own axis (hope that makes sense). Again, I appreciate your help!!!
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: thosj on January 01, 2022, 03:34:53 PM
You don't have to be a programmer to use Mach4, just some simple screen editor changes to get things "your way" then off you go. And.....Mach4 WILL run your machine much better that Mach3 ever did. Trust me, it was a hard pill to swallow for me, too, but now that I'm there, Mach4 is SOOoooo much better.

If you need the axis to be a slave, don't you NEED it to be a slave? Normally a slave axis is used on a machine that needs two motors driving one axis, like a gantry router. I don't know much about slaves, homing with a slave axis, or anything, really, so someone else will need to chime in here to help you out.

Hang in there, man, there are lots of folks here to help, but they're somewhat intolerant of questions asked that are easily answered by searching the forums or watching a few youtube videos!!! Not like LinuxCNC, however, where you're a dumb ********* if you can't program the kernel itself!!!

Tom
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: joeaverage on January 01, 2022, 04:08:34 PM
Hi,
in Mach4 you don't use an A axis as a slave to the Y axis.

Every axis in Mach4 has one master and up to 4 slave motors. Naturally all the slaves have to be tuned the same as the master, that is, velocity, acceleration and steps per,
but you can reverse the direction of the slave relative to the master by using the reversing the DIR pin.

So redo your y axis to have one master and one slave, say motors 1 and 2.

If you require it you can programmatically separate the master and slave so you can jiggle the slave back and forth to square the gantry and then programmatically link
it back to the master. Light years ahead of Mach3.... in fact its so far ahead your previous knowledge of Mach3 is almost a disadvantage, you'll be tempted to try to do things
the Mach3 way when there is a new method that far FAR FAR exceeds it in Mach4.

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

Description:
Map a motor to an axis.
Code: [Select]
LUA Syntax:
rc = mc.mcAxisUnmapMotor(
number mInst,
number axisId,
number motor)

Description:
Unmap the motor from the axis.


Craig
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: rufustoad on January 01, 2022, 04:38:00 PM
Hi,
in Mach4 you don't use an A axis as a slave to the Y axis.

Every axis in Mach4 has one master and up to 4 slave motors. Naturally all the slaves have to be tuned the same as the master, that is, velocity, acceleration and steps per,
but you can reverse the direction of the slave relative to the master by using the reversing the DIR pin.

So redo your y axis to have one master and one slave, say motors 1 and 2.

If you require it you can programmatically separate the master and slave so you can jiggle the slave back and forth to square the gantry and then programmatically link
it back to the master. Light years ahead of Mach3.... in fact its so far ahead your previous knowledge of Mach3 is almost a disadvantage, you'll be tempted to try to do things
the Mach3 way when there is a new method that far FAR FAR exceeds it in Mach4.

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

Description:
Map a motor to an axis.
Code: [Select]
LUA Syntax:
rc = mc.mcAxisUnmapMotor(
number mInst,
number axisId,
number motor)

Description:
Unmap the motor from the axis.


Craig

WHOA Craig you are now throwing me for a loop ;D. That is a whole new learning curve for what you are saying about not having a slave for Y. Your probably 100% correct on the Mach3 knowledge but there are aspects to 3 I hate to give up but suppose if will be for the best. The frustration is you do need to have programming knowledge for Mach4 and I just don't have it but I am willing to learn.
I will tell you that the code you have included is confusing to me and wonder if you are aware of a video I could watch to do this? I am not sure where I would incorporate this code.
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: joeaverage on January 01, 2022, 04:53:31 PM
Hi,
no coding required to have a master and up to four slaves.

I you wish to get tricky about homing individual motors and squaring the gantry then yes some coding will be required,
but for regular homing to one home switch per axis....no coding is required.

See the attached pic being the Control plugin Axis Mapping Tab. You can see that Motor1  is assigned to the Y axis.
In the second pic I have assigned motor3 to be the slave to motor1, the master. Easy.

Craig

Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: joeaverage on January 01, 2022, 04:54:46 PM
Hi,
 sorry I posted that you can have four slave motors to each master, you can have five slaves!

Craig
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: rufustoad on January 01, 2022, 11:54:32 PM
Thanks again Craig. I still do not understand how a 4' gantry can be perfectly square without homing both a and y axis each time you start the machine. I have tried to put A on its own axis but Mach will not allow me to reverse the motor for some reason. I am still learning and will get there at some point but its a terribly frustrating road
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: joeaverage on January 02, 2022, 12:58:52 AM
Hi,

Quote
I have tried to put A on its own axis but Mach will not allow me to reverse the motor for some reason. I am still learning and will get there at some point but its a terribly frustrating road

Do you have a rotating fourth axis??? NO....then you have NO A AXIS.....fullstop. An A axis is rotary, whereas what you are calling your A axis
is in fact a linear axis motor slaved to it's Y axis master.

Once you have assigned a motor, say motor 3 per my previous example, then go to the Motor Tuning tab, select Motor 3 and set the Steps Per, max velocity
and acceleration exactly as the same as the master, Motor 1, per my example.

On the Ports & Pins tab of your motion controller plugin you will have to assign a Step pin and a Dir pin for the new motor, Motor 3.
If you need to reverse the direction of the motor  reverse the Dir pin, from active high to active low or vice-versa.

If your steppers never missed any steps then the two motors, Motor 1, the master, and Motor 2, the slave would always remain in step and te gantry would
never get out of square.

May I suggest in the first instance that you have just one active Home switch, normally on the master motor side of the gantry. When you home
or reference the axis both the master and slave will drive together until they hit the Home switch. At which point Mach will back both motors back a little until
the Home switch deactivates and zero's the machine coordinates for that axis. With any sort of luck you won't have to jiggle one motor until
the gantry is square, it should already be square and stay like that for months at a time. If it gets out of square you should try and find out why.
There are some gantry squaring procedures but start with the obvious and easy one....it may well be enough.

Craig
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: thosj on January 02, 2022, 08:20:50 AM
Great stuff from Craig, as usual. An A axis doesn't NEED to be rotary, but that said, on your router, it's unlikely you have a linear A axis either, so disable it!!
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: rufustoad on January 08, 2022, 12:14:58 AM
Hi Craig, thank you again for your reply. I completely understand your comment on the A axis but I disagree with your assessment. 1st Mach3 calls out the slave as an A axis and it must be set as such. 2nd you should ALWAYS home both sides of your gantry everyday. When you power off your machine all motors release and you can easily move one end of the gantry without noticing it and all cuts going forward will be off. Here are some instructions from Avid:
The following instructions go over the hardware and software settings required to set up Homing (including auto-squaring of your gantry for dual-drive machines) and Limits with our inductive proximity switches.

The switches themselves are fairly simple, but setting up the coordinated motion of the machine for homing is best done with the following step by step approach.

1. Proximity Limit Switch Installation
Homing your machine requires moving each axis towards its designated home sensor, so it is important to make sure your motors and sensors are installed in the correct physical positions on the machine.

On machines with slaved axes, it is particularly important to verify which axis is the primary Y, and which is the slaved Y (generally the B axis, however in some cases the A axis, depending on the controller you have), as the Y and slave Y sensors (again, B or A) need to be matched with the correct axis of motion for auto-squaring.

B or A   B or A (Y slave) Home   Sensor A/B is used for auto-squaring the gantry during homing, so needs its own port on your controller

Unfortunately I have an older machine and do not have prox switches but the purpose is the same. I am still struggling to get Mach4 to continue on to home the slave axis. I can home 10 times and maybe 3 out of the 10 times the A axis or Y slave will actually home and I can not understand why. Most times it will stop just as the Y master clicks and then retreats.
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: joeaverage on January 08, 2022, 12:31:50 AM
Hi,
if your two motors never lost steps then your gantry would never get out of square....and surely you want to achieve that,
in which case just one Home switch would work.

There is a thread running on the Warp9 TD forum, and as it turns out the ESS, when homing, treats the master and slave as independent and
will home both simultaneously each to their own Home switch. The axis is considered Homed only when both motors are homed.
Does that sound like what you want?

Go check it out.

Craig
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: rufustoad on January 08, 2022, 09:50:00 AM
There is a thread running on the Warp9 TD forum, and as it turns out the ESS, when homing, treats the master and slave as independent and
will home both simultaneously each to their own Home switch.

Yes I would love to see this thread. Would you happen to have a link I could use? I have spent a few hours looking for it now and not seeing it. Thanks for the help!!
Title: Re: Can someone tell me why Z wont go to work zero and why Axis 3 ERROR??
Post by: joeaverage on January 08, 2022, 01:17:22 PM
Hi,

https://warp9td.com/index.php/kunena/7-general-discussion/9092-about-g31-and-ess (https://warp9td.com/index.php/kunena/7-general-discussion/9092-about-g31-and-ess)

Craig