Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: rufustoad on March 20, 2023, 08:29:10 PM

Title: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on March 20, 2023, 08:29:10 PM
I have so many questions, but I will start with why in the world would Mach remove the Diagnostics tab in there screens??
The big question I have and has been beaten to death but I still cannot figure it out is why can I not get A) any of the axis to back off of the homing switch when I use the switch as a dual limit and home? B) if I disable the limits and just have the switches as home then all the axis back off except Z and I have to actually give it an offset to retract from the switch? C) why won't Z axis go to its work zero when called to but all others do?
I have been putting this off now for over a year and I just expanded my table to 10' so I thought it would be a good time to make the dreaded change. I am sure I am missing something easy so any help would be appreciated.
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on March 21, 2023, 12:19:38 AM
Hi,

Quote
I have so many questions, but I will start with why in the world would Mach remove the Diagnostics tab in there screens??

The screen set is editable, so find the screen set that has the best Diagnostics tab in it, Copy and paste it into your current screen set.

Quote
The big question I have and has been beaten to death but I still cannot figure it out is why can I not get A) any of the axis to back off of the homing switch when I use the switch as a dual limit and home? B) if I disable the limits and just have the switches as home then all the axis back off except Z and I have to actually give it an offset to retract from the switch? C) why won't Z axis go to its work zero when called to but all others do?


Homing is a realtime procedure and it by definition handled by the motion controller autonomously. The questions you pose are actually about the motion controller behaviour not Mach4.

For example for some years it was possible if you were using a PoKeys57CNC to have the axis back off a certain distance of a home switch, but few, in fact none of the other motion controllers
had that feature. Over a period of time other manufacturers did so....but note, it was the responsibility of the motion control manufacturer to do so not Mach4.

Note this is different to Home Offset. That is a feature of Mach, and has been since the earliest days of Mach. When an axis homes it travels towards the home switch until the switch activates.
The machine slows to a stop and then backs up until the switch de-activates. Depending on the switch the back-up is only 1/2 a mm or so. The motion control reports to Mach that
the axis is now Homed, and Mach duly sets the machine coordinates of that axis to zero........unless you have programmed a Home Offset, it which case the machine coordinate of that
axis is set to the Home Offset instead.

This might occur because for instance your Home switch is 100mm from the end of the axis but there was too many things in the way to put it right at the end. So you would program the
Home Offset to be 100mm and when Mach set the machine coordinate it would set it at 100mm. So despite homing to a switch that was still 100mm away from the end when the Homing
procedure was finished Mach would still 'know' where the end is. That is what Home Offset is for.

But please note Home Offset does not move the machine anywhere, its just a numeric adjustment to the Homing routine. Various manufacturers call it by different things, but mostly some variation
of 'Back Off Distance'. But again note that this is in some ways redundant because all you had to do with a controller that did not have Back-Off, was to home the machine and then call a G0 Xnnn.
as the first move, and lo the axis would back off the required distance. All the manufacturers have done is to include that extra move command automatically....you don't even see it.
You could however replicate it...its not that hard.

Quote
C) why won't Z axis go to its work zero when called to but all others do?

If you look at the GotoWorkZero() function in the screen load script you'll see that it only includes the X and Y axes. If you want it to include the Z axis just put it in....but be prepared for some
major crashes!!! In fact if you go to do this will you let me know...I could do with the entertainment!!! I joke. The last thing you want is the Z axis diving down to the Work Zero, commonly
the surface of the material. If you made as much as a 1mm mistake in your Work Zero you'd drive the tool hard into the material.

As I say put that code in there if you like but remember you asked for it.

I've been using Mach4 for eight years, and I've never found it necessary to drive the Z axis down into the danger zone that aggressively. Nor have I found it necessary to have an automated
back off distance, the machine homes and sits there waiting for me to jog to a convenient work location. If I felt the need I would attach the back off movement command at the completion of the
Homing procedure and not bother my motion control with it at all. I suppose I could use my ESS as it has back off feature, I've never had need to use it.

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on March 22, 2023, 09:32:22 PM
Hi Craig,

The screen set is editable.
This was the entire reason I for putting SCAERED in my title as I am far from a programmer. I did however figure it out and did make it happen. I have to figure out load the touch plate stuff as well.

The questions you pose are actually about the motion controller behaviour not Mach4.
I am not sure I understand as I did come from Mach3 and I am comparing 4 to 3 as well. It was working as I suggested in Mach3.
This is somewhat confusing to me though as I would "think" it would be Mach that would ask the axis to move to the switch and then back off. I am using an ESS but I would not be apposed to getting a new one if I needed to.

If you look at the GotoWorkZero() function in the screen load script you'll see that it only includes the X and Y axes. If you want it to include the Z axis just put it in....but be prepared for some
major crashes!!!
I cant believe you would take joy in a crash HEHEHE I have figured out that if you stick your finger inbetween the bit and the bed you wont harm the tool  ;D
Again I am comparing from Mach3. If you were not able to go to Z Zero how would you know if you made a mistake or not? I will definitely look into adding that as you pointed out.

 the machine homes and sits there waiting for me to jog to a convenient work location. If I felt the need I would attach the back off movement command at the completion of the Homing procedure and not bother my motion control with it at all.
This could very well be what I am missing?? I am going to assume you have HOMING and LIMIT switches independently of each other?? Can I assume what you are saying is I need to program in a BACK OFF PROCEEDURE in Mach4??

Lastly do you know where I can find a video that shows you how to change the touch button to be automated like it was in Mach3 using the AutoTouchPlate?

Thanks again as this is a bit of a learning experience to me and hard to find people that like to teach what they know!
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on March 22, 2023, 10:17:18 PM
Hi,

Quote
it would be Mach that would ask the axis to move to the switch and then back off. I am using an ESS but I would not be apposed to getting a new one if I needed to.

In a sense you are right, but remember that Mach issues movement instructions which end up in a buffer, many hundreds of milliseconds long whereas the motion controller
can do things immediately or at least within a few microseconds, near enough to immediately. For instance let say Mach was waiting on the Home switch to operate.
The home switch operates and then Mach would be signalled up to 25ms later, then Mach would issue deceleration moves and they would propagate through the
motion buffer, say another 180ms. It just takes too damned long, the machine would have crashed before Mach knew anything about it. For this reason the motion
board must do Homing autonomously. It reports back to Mach when its done, but the motion controller is what does the business. Mach (3 or 4) has always been this way.

Quote
I am going to assume you have HOMING and LIMIT switches independently of each other??

I personally have done that with my new machine. I have three independent Home switches and six independent Limit switches , each one on their own input. You don't have to do it this way,
but I did. My new mill does 25m/min so I decided I wanted independent Limits switches, and just so Mach is at no time confused three independent Home switches as well.

Quote
Can I assume what you are saying is I need to program in a BACK OFF PROCEEDURE in Mach4??

The ESS has a back off provision, although I've never used it. You could alternately program such a move so that it happens automatically, either has the same result.
Internally the ESS does the move  automatically just as you would program it.

Quote
Lastly do you know where I can find a video that shows you how to change the touch button to be automated like it was in Mach3 using the AutoTouchPlate?

There are example scripts that ship with mach that you can copy and adapt to your machine. I seem to recall Daz-the-Gaz released a video dealing with that, look up the video section
of the board. Daz's videos are a great resource for newcomers.

Mach3 and Mach4 are sufficiently different that some ideas in Mach3 are just not applicable in Mach4. There is  feature  in Mach4 called the Signal Library and the signal script,.....its a whole new way
of dealing with signals and puts Mach3 in the shade. There is a catch.....it will do your head in for a wee while, thereafter you'll be fine, but initially its just not that easy.

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on March 23, 2023, 08:55:18 PM
Well, again I cant thank you enough for the help but being the slow leaner I am I still cannot grasp why Mach3 worked and 4 doesn't. I can't even get the Jog button to jog the freaking gantry .010" increments. The green light comes on but it still runs full tilt. Now you know why I said I was scared. I don't believe Mach4 is capable of helping the non-programmer which really sucks. I really would have thought the basics would have stayed the same like backing off a switch. It all worked in 3 even incremental jogging. I really did not want to spend hours researching on how to use this software, but I may not have a choice. I'm sorry to vent just frustrated.

As I say put that code in there if you like but remember you asked for it. I might not put that code in but again I am used to Mach3 and I never crashed it in over 2yrs BUT I agree there is always a first:)

Wow I do wish I had all those safeties. I had an AVID 4x4 and I just converted it to a 10' with hopes of putting a 4th axis on the end. I have had to do a ton of wiring as you could imagine. I am using 1 C11G and 1 C10 and believe they are on the lower end of the scale for CNC boards. I would like to upgrade to something with more inputs and able to utilize 12v so I can use proxies. What board do you use to supply all those inputs?

Just out of curiosity is the latest Mach4 OK to use? I see some warnings that Mach4 Hobby Version 2.0.5036 is not recommended?? Did I do bad by downloading this? I did load and older version but then loaded this after seeing it on the home page of Mach
So many videos and warnings but most of them are really outdated.
This is the warning on Warp9's website,
NOTE!!!! Build 5000 is having probing issues with the ESS plugin... Mach4 Build 4809 with ESS 283 is what we are recommending at the moment. January 15th, 2023
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on March 23, 2023, 09:24:09 PM
OK I figured out the increments but not sure how to make the keyboard work with it yet! Going to make my first cut  :-\
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on March 23, 2023, 09:34:01 PM
Hi,

Quote
I don't believe Mach4 is capable of helping the non-programmer which really sucks.

Rubbish, Mach4 is ready to rock for all basic machines, no programming required. You do need to turn on or off a couple of features but that's it. You can be making chips in under an hour.

Homing in Mach4 behaves exactly like Homing in Mach3.

Quote
I really would have thought the basics would have stayed the same like backing off a switch.

That was NEVER in Mach3, certainly at the beginning, and it is still not in Mach3 per se but in  the  motion controller....and always has been. Whats happening here is that you have
become accustomed to the features of Mach3 which have sought of evolved....and imagine that they are standard features....they are not. Now you have to actually understand how they
work and replicate that behaviour in Mach4 and given you do not understand how it was done in Mach3 makes it tricky. Its not that Mach4 is hard just that Mach3 had a lot of funny
work-around features which should probably never have been there.

The people whom struggle with Mach4 are those with a long history of Mach3. They seem to imagine the shortcuts, work-arounds and downright bugs in Mach are the 'standard' way of
doing things or worse the only way of doing things...they are not. Mach4 is and was purposely designed to be as close to identical as possible to Fanuc 21i, being as close to an industry standard
as there is. Mach4 can be made to do all the things that Mac3 could and many many more, but whats really important is that it conform to Fanuc21i right from the get go out of the box.
All the frilly bits can be added later.

When I first stared with Mach4, I had within a few months programmed a lot of features that replicated what Mach3 had....but over a period of time they have all disappeared.
In the end I decided they added little or nothing....so the only custom parts to my current Mach4 installation are actually things I use and are productive for me. Anything
else is just wasting time when I should be getting on with the paying work.

Quote
I can't even get the Jog button to jog the freaking gantry .010" increments. The green light comes on but it still runs full tilt.

Have you filled out the jog increments on the Control Plugin page? It sounds like you are suffering from after-run which is where the 'clicks' or increments accumulate faster than the
machine can consume them and therefore they get 'saved' up and will carry on even once you stop jogging. This is a common fault, and used to happen in Mach3 in exactly the same
way and for exactly the same reason. It turns out the machine is doing exactly what you tell it to do.....but your settings have made after-run that much more likely.

There are a couple of threads on the Mach4 board that deal with exactly this and there is a thread on the Warp9TD forum that deals with it also.

Quote
What board do you use to supply all those inputs?

I made my own. Its not that dissimilar to an MB3 by CNCRoom. All three ports are fully developed, all 24V tolerant. All Step/Dir outputs (12 of them) are differential.
Has a 24VDC output for the Z axis brake, a built-in high linearity PWM to analog converter and ON/OFF relay for a VFD driven spindle.

Note that my breakout board has eight pin sockets down the lower side, one plug for each axis servo, all of them X,Y,Z,A,B and C....and yes I have a C axis, that is an angular position
capable spindle that allows me to do rigid tapping.

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on March 23, 2023, 10:09:38 PM
Hi,

Quote
NOTE!!!! Build 5000 is having probing issues with the ESS plugin... Mach4 Build 4809 with ESS 283 is what we are recommending at the moment. January 15th, 2023

Yes, that is correct. When NFS released build 5000 there are certain sections of code which now run blazingly fast, so much so that many motion controllers including the ESS couldn't
keep up. It created a race condition. Most of the motion board manufacturers are making changes necessary to accommodate the much increased speed.

My current build is 4612 and ESS 277. I've been using them for months, may be even a year. Prior to that I had been using build 38nn?? or something, I can't remember, but it had been in use on my
machine for two or three years. I eventually updated to 4612 but as far as I know there is nothing in the latest builds (5000 or thereabouts) I need or want....so why bother?
It comes down to what I posted earlier, my machine is for making parts, if the software is working well now then all I'm doing is wasting time instead of getting on with the work I should be doing.

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on March 23, 2023, 10:32:00 PM
Hi,
speaking of what I should be doing, I have attached a pic of my fourth axis, I finished it about 8 weeks ago.

I will take the chuck off and substitute a trunnion table and a fifth axis soon. The pic attached is of the fifth axis parts I've got so far.
I have the 750W Delta servo and drive, a you 'beauty' low lash <1 arc min Atlanta Drives servo reducer. I need to reduce the profile so the
trunnion can rotate +90 and -90 degrees without the servo fouling the mill bed so this servo  will be pulley and belt coupled, the pulleys are pictured.
Still need the belt. Have a big lump of 4140 steel that has been rough turned for the C axis platter.

Will hopefully be able to squeeze the budget a bit tighter and get the steel for the trunnion table cut next week. Looking for 32mm thick for the base of the trunnion
and 20mm thick for the uprights. Will have to be bolted.....my nearest heat treat facility is now 1500km away, although this should not be huge or overly heavy
so welding and heat treating may yet be on the cards.

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on March 26, 2023, 11:29:05 AM
Rubbish, Mach4 is ready to rock for all basic machines, no programming required.
The reason I say that it is not simple, lets take an easy one such as the Keyboard Function, I would think that this would have an easy option to make it come on as soon as Mach is opened but it does not. You have to go in and program it to come on and there are just not enough videos out there to show you how to do this type of stuff. I am not a programmer and have been struggling to get simple things like this to work. For industrial software I would say yeah its pretty good but for a hobbyist I might have waisted $200. OH well I will figure it out but again just frustrating. Your definitely correct the people whom struggle with Mach4 are those with a long history of Mach3.

By what you are saying I really dont need to worry about changing back to an earlier version of Mach as I dont think I do enough on this machine to worry about code speeds or race conditions (I hope)
The pics you posted are of a tank for a 4th axis. I am really hoping to get to this point sometime soon. Are you machining metals with that?
Are you in the states? You do any YouTube vids??
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on March 26, 2023, 12:31:22 PM
Hi,

Quote
The reason I say that it is not simple, lets take an easy one such as the Keyboard Function, I would think that this would have an easy option to make it come on as soon as Mach is opened but it does not.

When you fire up Mach in standard form the keyboard is inactive, as a safety measure. Press one button and its active....seems simple enough.
If you wish it come on automatically at start up and accept the risk of an active keyboard rather than actively and specifically turning the
keyboard on, then add one line to the PLC script:

KeybordsEnableToggle().....thats it, one line of code in the PLC script. If this is the feature you want then turn it on!

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on March 26, 2023, 03:35:03 PM
Hi,
Jeez, its even simpler than that......you don't need to add a line to the PLC but rather just comment one line out!

The first thing you need to understand is that the onscreen button that you press to enable the keyboard is just a trigger for a function.
What function you ask....check out the pic. It shows the screen editor open and showing the event of the <KeyboarEnable> button.
Note that te function is called KeyboardEnableToggle().

Given that its a toggle, if you press the button it changes from Off to On or from On to Off, simple enough.

In order to enable the keyboard automatically you want the function to run, just once somewhere near the beginning of the program.

When Mach starts up the first part to run is the ScreenLoad script. As the name suggests it loads all the screen elements. It might be possible to run a function here
but what happens if that function relies on another piece of code that has not loaded yet?. The smart way to do it is to wait until ALL the code has loaded and THEN run
the function. As it turns out there is a good way to do this.

The PLC script is equivalent to the macro pump in Mach3. It runs every 10 milliseconds or so. So the process is that the ScreenLoad script runs and once it completes and everything
is loaded then the PLC script runs for the first time. What we don't want however is for the function to run and then a little while later run again...and again...and again...etc.
The PLC has a counter called 'testcount' and is set to 1 at start up and increments every time the PLC runs. There is a small section of code within the PLC script that runs ONLY when testcount=1,
ie it runs only once, at first startup and thereafter given that testcount is no longer equal to 1 not again.

This is that section of code:
Code: [Select]
-------------------------------------------------------
--  PLC First Run
-------------------------------------------------------
if (testcount == 1) then --Set Keyboard input startup state
    local iReg = mc.mcIoGetHandle (inst, "Keyboard/Enable")
    mc.mcIoSetState(iReg, 1) --Set register to 1 to ensure KeyboardInputsToggle function will do a disable.
    KeyboardInputsToggle()
   
---------------------------------------------------------------
-- Set Persistent DROs.
---------------------------------------------------------------

    DROTable = {
[1034] = "droEdgeFinder",
    [1035] = "droGageBlock",
    [1036] = "droGageBlockT"
    }

This is found by opening the screen editor and looking at the events tab of your screenset, the very topmost element of the file tree.

And look at that, there is the code to turn the Keyboard on, and then for safety its toggled Off by the exact function we want to run. If you comment it out
it will not run and therefore the Keyboard will remain on. Is that what you want? So just add two '-' marks in front of the function call KeyboardInputsToggle()
and you're done. It should look like this:
Code: [Select]
-------------------------------------------------------
--  PLC First Run
-------------------------------------------------------
if (testcount == 1) then --Set Keyboard input startup state
    local iReg = mc.mcIoGetHandle (inst, "Keyboard/Enable")
    mc.mcIoSetState(iReg, 1) --Set register to 1 to ensure KeyboardInputsToggle function will do a disable.
    --KeyboardInputsToggle()
   
---------------------------------------------------------------
-- Set Persistent DROs.
---------------------------------------------------------------

    DROTable = {
[1034] = "droEdgeFinder",
    [1035] = "droGageBlock",
    [1036] = "droGageBlockT"
    }

Couldn't be much simpler than that. The functionality that you want is already right there, all you have to do is decide whether you want it ON or Off. NFS chose Off for safeties
sake, and can't really fault them for that, but you may choose otherwise, and by adding a couple of comment marks its done.

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on March 27, 2023, 07:31:50 PM
HAHA you did it!! I turned it on and now the keyboard is active when I start MACH although the button doesn't turn green anymore which isn't a huge deal!! Thank you. I hope I can set up a Xbox controller.
Now I will try and turn on the Z axis BUT I have a question about that.
A) how do I know which script I should be in when modifying these buttons like Screen Load Script or Screen Upload Script or PLC Script?
B) In the Move to work zero script, If I want Z to move to a Safe Number First before X+Y moves, say it raises to Z=-500 below MACHINE ZERO then X+Y Move to zero then Z drops to work zero IS THIS POSSIBLE TO DO? This is how Mach3 worked, and I like that as I could have several pieces being cut in G54, G55 etc? Hope that makes sense.
I have caught Z not where it should be several times and I am not sure how else to make sure its on top of the part unless I watch it.
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on March 27, 2023, 08:53:17 PM
Hi,

Quote
A) how do I know which script I should be in when modifying these buttons like Screen Load Script or Screen Upload Script or PLC Script?

That is all part of the Mach4 learning curve. It was not really necessary to understand the inner workings of Mach3, all features, good and bad were exposed
and in many cases automatic. Mach4 is very different that that regard. It is a structured software with significant modularity. Understanding how control flows from
one section to another is both important and a challenge. Its a case of starting small and working your way up. You have now encountered two scripts, the
ScreenLoad and PLC scripts....that will keep you going for a while yet.

The ScreenLoad script is the most significant one, and it is where you'l place most of your function definitions. It is also the location of the SigLib{}, aka Signal Library Table.
That is where you'll be putting code for inputs and outputs.

The PLC script is also important if you need or want  a polled input. The downside with the PLC is that it runs every wee while....if you make a mistake in your coding its going
to fail again and again, often locking you out.You should thoroughly test any code 'in a sandbox' before you put it in the PLC script.

The Screen Unload script is what runs when Mach shuts down, things like storing data, and settings. It is largely automatic and seldom needs editing or additions.

Quote
In the Move to work zero script, If I want Z to move to a Safe Number First before X+Y moves, say it raises to Z=-500 below MACHINE ZERO then X+Y Move to zero then Z drops to work zero IS THIS POSSIBLE TO DO?

But isn't that exactly how Mach4 works now?

The <GotoWorkZero> function as shipped, moves the Z ie Z zero in machine coordinates ie to the very top of travel and out of harms way, THEN moves to the X,Y  zero. Thereafter, if you
have programmed it so the Z axis descends into the work zone. Isn't that exactly what you want, but rather than go to 'some safe height' it goes to the very top of the Z axis,
surely that is a safe as you can get?

My preference is as Mach ships where the X and Y axes got to zero, but the Z axis remains out of harm way right at the top, rather than drive down into the work zone
Then I jog the Z axis down manually. I can confirm that my Z zero is correctly set without risk. Having it drive down automatically risks any mistake being found but only AFTER a crash.

You can code it to go to some other height, say Z zero (work coordinates) plus some safety allowance, say 50mm. Note this is not standard code but would require you edit the
standard code to reflect your preference.

Fusion 360 allows a parameter 'Clearance Height' and is very convenient and is related to the part you are working on. When the tool path is simulated it
is the perfect opportunity to preview the Z zero and its suitability. When I do rotary four axis paths I specify a safe Z location, but that is done on a per part basis.

The thought of automatically driving to Z zero (work coordinates), especially without some safety allowance gives me the chills!

Craig

Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on March 28, 2023, 01:31:36 PM
That is all part of the Mach4 learning curve.
You can say that again!


But isn't that exactly how Mach4 works now?
No. The Z would go to zero, trip the switch and all would stop. I then tried to give Z a neg-.500 number to stop it from hitting the switch and then the z would travel up and just stop. I then figured out that A is also included in this operation and it did not like it. I removed A0 from the code and now it works as it should. I want to isolated A and remove it from being a slave and have it home independently but that is a completely other video:)

My preference is as Mach ships where the X and Y axes got to zero, but the Z axis remains out of harm way right at the top, rather than drive down into the work zone Then I jog the Z axis down manually.
I do not disagree with this but again it reverts back to a normal process I was use to with Mach3 and being new with 4 I hate to make to many changes to soon. I will probably revert it back and do as you suggested for safety.

Fusion 360 allows a parameter 'Clearance Height' and is very convenient and is related to the part you are working on.
This is also a learning curve. I just recently purchased 360 because I bought a CNC mill and needed the CAM side of things. I am trying to learn it but this will take a while. I use Aspire for this Mach4 machine. I really like Aspire and its capabilities. Its not as much as 360 but its simple and the drafting is endless.

Now all I need to do is figure out how to install the AUTO Touch Plate with a new button and I will be making wood chips again. I believe Avid did a video on this a few years ago but I cant seem to find. I will though.
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on March 28, 2023, 03:42:27 PM
Hi,

Quote
No. The Z would go to zero, trip the switch and all would stop

My apologies, I've had a much closer look at the code and realised its not quite how I thought. These are the two lines in the function:

Code: [Select]
mc.mcCntlMdiExecute(inst, "G00 X0 Y0")--Without Z moves
    --mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0 A0\nG00 Z0")--With Z moves

Note the first line  mc.mcCntlMdiExecute(inst, "G00 X0 Y0") just moves direct to x0y0 irrespevtive of where the  Z axis is. If its up above the material
all is well but if the tool is still down in the material then it will drag through it on the way to x0y0.

The second line  mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0 A0\nG00 Z0") goes to Z zero, but in machine coordinates, and then to x0y0, and then to z0
in work coordinates. Thus the initial move is up and out of the way. When you say the machine stops is because it hits the Z axis limit switch. That's your own fault...
whats the point of having a Home location that errors out? The home location should be say 1mm inside the Limit switch so that you can drive to the Home location
without a Limit fault.

Just as an example: my mill has three switches on each axis, two Limits and one Home switch. The Limit switches are and the very end, about 1mm inside the mechanical
stops. I have set the SoftLimits to be about 1mm inside the Limit switches and the Home switch about 1mm inside the SoftLimits. That means my Home location is 2mm
inside the Limits, and consequently I can drive to the Home location WITHOUT triggering either a Limit OR a SoftLimit.

I have attached a pic. You can see the switch on the left is slightly closer to the top of the Z axis and is the Z axis upper Limit switch whereas the switch on the right is somewhat lower,
ie the Z axis Home switch.

I have elected to have two Limit switches and one Home switch per axis, and all on their own breakout board input but you don't have to do that. You could use the upper limit switch
as a Limit and a Home, but you need to set a realistic Home Offset parameter so that Mach can distinguish between a Home and a limit. Lets say you choose a Home Offset of 2mm
then in the code above the Z axis would go to the near (within 2mm) the top, but would not trigger the Z axis limit. 

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on March 29, 2023, 11:41:06 AM
When you say the machine stops is because it hits the Z axis limit switch. That's your own fault...
Nope it wasn't my issue. It did not like the A0 command. You are somewhat correct but I changed to"G00 G53 Z-.5\nG00 X0 Y0 A0\nG00 Z0") in the G53 and it still stopped. Then I removed the A0 from the 2nd command and it corrected the issue. That was a bit painful but nun the less I fixed it and now my Z only rises to just below Z0.
As I said prior I really like having my A motor as a NON SLAVE on the Y Axis and will post again when I start to change this. I have tried and for some reason I am missing code such as the above to make this work but I am going to cut some stuff first before attempting this again. Appreciate your help.
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on March 29, 2023, 02:39:46 PM
Hi,

Quote
You are somewhat correct but I changed to"G00 G53 Z-.5\nG00 X0 Y0 A0\nG00 Z0") in the G53 and it still stopped.

Yes, that will work, but that also means that the machine Z zero is at the very top of the axis and that is where the Limit switch is.
If you have any code that calls for a G28 or G30 for instance you're going to run into the same problem.

I would suggest that you experiment with Home Offset. It does a very similar thing but makes the Z zero just inside the Limit switch.
Then you can go to Z zero without triggering a Limit. That is what Home Offset is for, and indeed it worked in identical fashion in Mach3
so has been around for twenty years.

You are correct, when you use wx4.set you get A axis moves, being the fourth axis. If you have a three axis machine you need to strip them out.

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on April 01, 2023, 11:48:49 PM
So, I really want to have my A/slave axis home on its own that way I am 100% my gantry is always perfect. I have had several issues in the past where a tooth might skip or something gets in the way and the gantry will slightly become out of square and I want that to go away. I am in the process of putting all the axis on there own switches like joeaverage posted in some pics but setting up A axis to do its own thing has proven a bit difficult.
Is there a video someone is aware of that demonstrates how to set this up? All I can find is how to home vids that are not working.
I have started the process but I am struggling as it completely stops this axis when I try to move it.
Could there be a coding issue like I experienced with the z axis? If I can get a feel for how to set this up I think I can figure it out.
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on April 02, 2023, 12:11:55 AM
Since A is a slave to Y is it even possible to have all 4 motors home independently?
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on April 02, 2023, 12:29:53 AM
Hi,

Quote
Since A is a slave to Y is it even possible to have all 4 motors home independently?

That is Mach3 thinking....you do not slave that way in Mach4. You have a Y axis master and upto to four slaves to that master. The A axis has got
nothing to do with it.

Yes it is possible to home motors independently....however if you have one motor on one end of the gantry and another motor on the other end they
need to move together or you will wreck the gantry. It is possible to jiggle one motor back and forth a wee bit to square the gantry....if that's what your thinking.

Whats more the ESS does this automatically if thats how you set it up.

Note the attached pic has 4 axes, X,Y,Z and A and a slave motor (motor4) on the Y axis.

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on April 02, 2023, 10:11:16 AM
You have a Y axis master and upto to four slaves to that master.
I have it set up that way. I have no issues with this machine as it sets and works perfectly right now. The only problem is there are times that I make a mistake and a motor will skip a tooth or something happens that takes my gantry out of square. This is a 5' gantry and its super easy for this to happen.

It is possible to jiggle one motor back and forth a wee bit to square the gantry....if that's what your thinking.
I spent hours squaring up all axis. I am within .001" in 4ft and jiggling a motor isn't very accurate. I now have both homing switches exact with each other. For some reason I cannot get the slave to home independently

Yes it is possible to home motors independently.
Is there a doc or video that shows how to do this? I have tried to set this up as I have the other motors to home and when I do the motor just stops and is no longer responsive. I am sure I am missing something quite easy but I cant see it.
I am not sure if you have to unslave this motor and make it the A axis master or if I can keep it a slave and home independently of the Y master. What I am doing isn't working. I cant even get the green homing light to come on for that motor
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on April 02, 2023, 03:00:30 PM
Hi,
do you have an A axis?. If not then forget the A axis it has nothing to do with your machine. In Mach4 you operate on a motor,
say motor1 or motor4 or whatever. You can move any motor individually if required but ordinarily if motor1 is Master and motor4 is Slave then they
move together, after all that is what Master/Slave means.

What motion control are you using? The Ethernet SmoothStepper can automatically square a gantry to two squarely set Home switches.
You do have to set it up correctly but it is otherwise automatic. What it does in effect is Home the two motors simultaneously but independently
to their respective Home switches.

You can programmatically link and unlink motors which in turn allows you to write sophisticated squaring routines....but you should
not really have to do that. Take advantage of what the motion control manufacturer put into the controller for that purpose.

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on April 03, 2023, 03:37:11 PM
do you have an A axis?. If not then forget the A axis it has nothing to do with your machine
I get what are saying but its hard to forget when you are taught to set up that way. Everything is configured to an Axis as you see in the pic.

What motion control are you using?
Warp9 v283. I would not be apposed to upgrading if you thought I needed? This ESS is over 10yrs old now

The Ethernet SmoothStepper can automatically square a gantry to two squarely set Home switches.
You do have to set it up correctly but it is otherwise automatic. What it does in effect is Home the two motors simultaneously but independently
to their respective Home switches.
Thats exactly what I was hoping for. Not sure why I am struggling with this so badly but I have changed every I would think was right and its not liking it. I assume I am missing something in the logic part of thing?

Take advantage of what the motion control manufacturer put into the controller for that purpose.
This is what I was hoping. I am looking for easy for now. I am a little confused I do not see other posts or video's of this same issue. This has to be a common function others are struggling with.
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on April 03, 2023, 03:39:59 PM
A few pics to look at. Might see something simple
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on April 03, 2023, 04:16:04 PM
Hi,
so you do not have an A axis??? Then why have you got an A axis defined in the Mach4 plugin?? That's a major source of your problem right there.
I don't care whether that whats you are familiar with in Mach3....this is Mach4 and its method of handling slaving different and is light years ahead.
Do yourself a favour and ditch all and every assignment you have made for a A axis, including the Step, Dir, Home and Limit pins.

Quote
Warp9 v283. I would not be apposed to upgrading if you thought I needed? This ESS is over 10yrs old now

The ESS is continually developed, so while the electronic part may remain the same, or nearly so, the firmware is constantly being improved, an is not
years old but days or weeks old at worst. Remember the ESS has an FPGA, which is if you like a software configurable 'computer'. If you find that your
currently defined 'computer' cannot do as you want it to, then use firmware to re-define the 'computer' to whatever suits your need.

Quote
Thats exactly what I was hoping for. Not sure why I am struggling with this so badly but I have changed every I would think was right and its not liking it.

The ESS has had this auto-squaring function for many years, you should take advantage of it. You will find out more about it if you go to the Warp9TD Forum.
Why this thread is on the Mach3 Discussion board beats me? You need and want information about Mach4....then why the Mach3 board?.  You need and want
information about the ESS auto-squaring function then ask in the appropriate forum.

There are several threads in the Mach4 Discussion board that deal with this subject and matters closely related to it in the last few weeks alone, but the real gen on how to set up
the ESS is the Warp9TD Forum.

Quote
This has to be a common function others are struggling with.

Yes there are others whom have stumbled over this but they ask the questions in the right places and then accept and implement the answers and the problem
is solved. You seem however seem to ignore the answers because its 'not the way I did things in Mach3'....and guess what; you'll never get it to work if you insist
of conflating Mach3 and Mach4.

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on April 03, 2023, 04:26:51 PM
IM sorry I didn't realize I was talking with THE GOD OF MACH. I didnt post on MACH 3 its on the general discussions page because this is a Mach 3 and 4 related issue. I am only looking for help NOT SOME ASS that feels he knows better than anyone else. You replied to this thread so GO AWAY IF YOUR NOT INTERESTED IN GOOD ADVISE! This set up was suggested by people that teach this stuff for a living I didn't just do this for fun.

You seem however seem to ignore the answers because its 'not the way I did things in Mach3'....and guess what;
What the hell are you talking about??

I've seen you belittle others on this site as well and its pathetic.
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on April 03, 2023, 04:49:12 PM
Hi,

Quote
You seem however seem to ignore the answers because its 'not the way I did things in Mach3'....and guess what;
What the hell are you talking about??

Because you are trying to use an A axis as a slave to the Y axis....that is how it was done in Mach3 but it is not done that way in Mach4 and
will not work that way in Mach4.

Quote
I've seen you belittle others on this site as well and its pathetic.

If my posts have offended you or belittled you please accept my apologies....it is not my intention to do so.

If you wish to find more information about setting up the ESS for auto squaring then try Andy at the Warp9 forum. I don't recall seeing videos on
it but there is plenty of instructions about it.

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: rufustoad on April 03, 2023, 11:11:17 PM
Im not trying to be a jerk and I apologize for a rude post that's not my nature, but I am sucking on a fire hose trying to intake as much info as possible and it is extremely frustrating when you search through hundreds of posts looking for information and you can't find it. You told me to change what I am accustomed to but change it to what, Motor 1,2,3? I will try changing these configs at some point when I am more confident but all is working right now except these few bugs. Everything I see says to import from Mach3 to Mach4 and that's what I did. I am a little disappointed Mach hasn't done a better job of illustrating some of this stuff. In my head what I am looking for should be as basic and normal as pushing the power button. Squaring a gantry is a must in most CNC applications I have ever seen but again I am a little new to routing as you can see. Again I appreciate your input that you have given me.
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on April 04, 2023, 12:11:12 AM
Hi,
I remember how frustrating I found converting to Mach4 from Mach3 years ago. I'm surprised you did not hear me, I'm only 14000km's away and I was really
shouting loud! It took me a couple of weeks to get the basics in hand and another two before I was comfortable. Another month after that I was coding my own stuff,
but it did not happen immediately.

My guess is that you have been given advice by people whom are familiar with Mach3 but without realising that certain aspects of Mach4 are strikingly different.

This is one area where Mach3 and Mach4 differ, and if you apply your Mach3 thinking it will lead you well and truly astray.

On the Axis Mapping tab assign:
X axis =motor 0
Y axis master= motor1   slave= motor3
Z axis motor 2

Per the attached pic

Now assign the motor Step and Direction pins and My suggestion is set the Home pins as well.
Note the are four Home switches, one for each motor, so two Home switches for the Y axis and one each for the X and Z axes.
Note also that I applied 1000 units of noise filtering on the four home inputs....just as a precautionary matter.

Per the attached pic.

To be perfectly honest I would not bother with Limit switches as yet. You can double up a switch to be a Limit and a Home switch....but it adds complication
that you do not want yet. Once you get the machine Homing properly and you understand how and why it does so THEN start adding Limits. You will know then
if you make a Limit assignment that screws with your Homing you may have to reconsider how you are using Limits....but not yet.

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on April 04, 2023, 12:22:54 AM
Hi,
now populate the Input Signals tab of the ESS plugin per the attached.

Note that I have not assigned any Limits yets....that will come later, and whats more it will be confusing because we are going to use
the same swtiches as Limits, or at least some of them.

Note how the ESS Homing tab has auto-populated, and note also the highlighted entries, they may become important later when you are trying to auto square
the gantry but the switches are not quite square.

Craig
Title: Re: Newby converting to Mach4 from Mach3 and scared but doing it
Post by: joeaverage on April 04, 2023, 12:36:01 AM
Hi,
now the last thing is to set the Homing&SoftLimits tab of the Control plugin.

This is where some confusion may arise. Note down the lefthand column you see X,Y,Z,A etc....in fact the axis letters are a red herring, the real point is the numbers, 0,1,2,3 etc
corresponding to the motor numbers. Note the the Z axis Homes first followed by the Z axis, but motor1 and motor 3 Home simultaneously, and motor1 is the Y axis master and
motor3 is the Y axis slave. That they should Home together is 100% correct. But note that they are quasi independent, that is motor1 will Home to its moror1-Home switch
and motor3 will Home to its motor3_Home switch. If the switches are set square then the gantry will end up square also, even if it started a bit askew.

Craig