Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: KingKerf on August 25, 2015, 02:40:09 PM

Title: Homing
Post by: KingKerf on August 25, 2015, 02:40:09 PM
I've been digging through these forums and the Warp9 forums and nothing is appearing to be working for me. I have 4 axis on my machine, but only 3 of them require homing. The Y axis is a rotational axis and set to Home in Place. I can not use the A axis as the rotational because then I wouldn't be able to use G2 and G3 to create arcs. The issue I am having is the X and Z axis home wonderfully and back off the switches after they make contact. The A axis however does not. It moves to the switch like its supposed to, then just stops when it makes contact. All three switches are wired in series. It isn't a crappy switch issue either. When the A axis is moving, I have manually activated the X Home Switch (same circuit) and it still just stops. even if I hold the switch in. I have included my machine settings file. If anyone has any insight, it would be much appreciated.
Title: Re: Homing
Post by: KingKerf on August 26, 2015, 04:25:56 PM
I have began trying to write my own sort of homing script. Homing each axis individually and swapping the Z and A axis in the middle (they are tuned the exact same). Everything starts out fine, but then the A axis moves in the wrong direction and clicking the homing switch doesn't stop the homing motion. I'm forced to hit the E-stop and restart everything. The script is as follows:

Code: [Select]
local inst = mc.mcGetInstance();

mc.mcAxisHome(inst, 2);

wx.wxMilliSleep(10);
mcState = mc.mcCntlGetState(inst);
while (mcState ~= mc.MC_STATE_IDLE) do
mcState = mc.mcCntlGetState(inst);
wx.wxMilliSleep(10);
end

mc.mcAxisSetPos(inst, 2, -0.25);

local motorIdA, rc = mc.mcAxisGetMotorId(inst, 3, 0);
local motorIdZ, rc = mc.mcAxisGetMotorId(inst, 2, 0);
mc.mcAxisUnmapMotor(inst, 2, motorIdZ);
mc.mcAxisUnmapMotor(inst, 3, motorIdA);
mc.mcAxisMapMotor(inst, 2, motorIdA);
mc.mcAxisMapMotor(inst, 3, motorIdZ);
mc.mcAxisEnable(inst, 2, true);
mc.mcAxisEnable(inst, 3, true);
mc.mcAxisSetHomeDir(inst, 2, -1);
mc.mcAxisSetHomeDir(inst, 3, -1);

mc.mcAxisHome(inst, 2);

wx.wxMilliSleep(10);
mcState = mc.mcCntlGetState(inst);
while (mcState ~= mc.MC_STATE_IDLE) do
mcState = mc.mcCntlGetState(inst);
wx.wxMilliSleep(10);
end

mc.mcAxisSetPos(inst, 2, -0.25);

mc.mcAxisUnmapMotor(inst, 3, motorIdZ);
mc.mcAxisUnmapMotor(inst, 2, motorIdA);
mc.mcAxisMapMotor(inst, 3, motorIdA);
mc.mcAxisMapMotor(inst, 2, motorIdZ);
mc.mcAxisEnable(inst, 2, true);
mc.mcAxisEnable(inst, 3, true);
mc.mcAxisSetHomeDir(inst, 2, -1);
mc.mcAxisSetHomeDir(inst, 3, -1);

mc.mcAxisHome(inst, 0);

mc.mcAxisSetPos(inst, 0, -0.25);
mc.mcAxisSetPos(inst, 1, 0);

mc.mcCntlGcodeExecuteWait (inst, "G53 G90 G0 Z0.0000 X0.0000 A0.0000");
Title: Re: Homing
Post by: KingKerf on August 27, 2015, 09:39:02 AM
I have tried switching the homing order all around. Every time it gets hung up on the A axis trying to home. And i originally started with using DazTheGas's homing script, however that is where I first established the issue of the machine freezing up when it hits the A Axis homing switch. The entire issue revolves around the A axis and its homing.
I have also pulled out of the previous code just the remapping of the A motor to the Z axis and tried homing just that, but the issue appears to be that the machine thinks that axis is already homed, so it just travels in the opposite direction of the homing direction trying to "get off the switch". But there is no switch activated.
Title: Re: Homing
Post by: Chaoticone on August 27, 2015, 10:22:26 AM
Are you sure your homing direction is right?

Have you asked Warp9 about this issue? The homing is handled by the motion device.
Title: Re: Homing
Post by: KingKerf on August 27, 2015, 10:34:49 AM
yes the homing direction is correct, and I have been working with Andy from Warp9 on their forums as well. Just making sure that I am covering all my bases. In case anyone has a work around over here as well.

It looks like I currently have Mach build 2472 and ESS build 130. I'll get those updated over the weekend and report back the results.
Title: Re: Homing
Post by: Chaoticone on August 27, 2015, 11:19:00 AM
Good idea to update. Things are changing fast at the moment. There have been some issues with licensing in the earlier V2 versions and I think that is sorted now but if your not going to get to play with the machine until this weekend I would wait until then to update. I hope you get it sorted soon and imagine you will.

Title: Re: Homing
Post by: KingKerf on August 31, 2015, 09:42:02 AM
No luck...After the updates to Mach X2660 and ESS build 132, I am still having the same problems as before. I have retried everything I have listed above and am still not able to Home the A axis.
Title: Re: Homing
Post by: dude1 on August 31, 2015, 04:45:05 PM
KingKerf run logging and hit ref all home button and post what comes up it will help nail down the problem
Title: Re: Homing
Post by: KingKerf on September 03, 2015, 03:15:49 PM
I can not post the log trace because when the machine makes contact with the A-axis homing switch, Mach4 goes into a nonresposive state. completely freezes. nothing can be done. As i have stated before....
Title: Re: Homing
Post by: dude1 on September 03, 2015, 03:17:35 PM
push it then hit E stop it will put out the start of homing, it is meant to come up a certain way
Title: Re: Homing
Post by: KingKerf on September 03, 2015, 03:30:12 PM
Attached is the Homing Log Stack for just the A-Axis.
Title: Re: Homing
Post by: DazTheGas on September 03, 2015, 06:43:30 PM
Perhaps this might help or not, it will start the logging within the plc and dump it out to a file called Output.log in the mach4 directory. The internal logging is a lot faster updating than this but might just take you to just before the crash.

Using the Screen Editor use the codes below.

--screen load script
Code: [Select]
local inst = mc.mcGetInstance()
mc.mcCntlSetLogging(inst, 1)
local done = ''

function WriteLog()
    local var = mc.mcCntlGetLastLogMsg(inst)
    if var == done then
    return
    else
    file =io.open("Output.log", "a")
    file:write(var..'\n')
    file:close()
    done = var
    end
end

and in the PLC Script

Code: [Select]
if testcount > 5 then WriteLog() end
Theres 2 variables being used here 'var' and 'done' just check and make sure these are not in use elswhere...

DazTheGas
Title: Re: Homing
Post by: dude1 on September 04, 2015, 12:48:42 AM
I tried daz`s homeimg code with changing the code to reflect A instead of Y it worked as it should under test condition`s I could not try on the machine it was being used
Title: Re: Homing
Post by: KingKerf on September 04, 2015, 09:47:12 AM
I have also tried His code. that is what i had started with. The issue is not with the coding that is done by me. I understand that the coding works as it should. My day to day job is software development. The issue is when my Motor 3 is mapped to the Y axis and Motor 1 is mapped to the A axis, Homing switches wired and activated accordingly, Mach4 will go into a non-responsive state when the A axis makes contact with its homing switch during the homing sequence.
Title: Re: Homing
Post by: DazTheGas on September 04, 2015, 10:40:40 AM
Your missing the point, we are trying to get the log so we can see what is called before it hangs.....

DazTheGas
Title: Re: Homing
Post by: KingKerf on September 04, 2015, 11:19:46 AM
I posted the log.

Attached is the Homing Log Stack for just the A-Axis.
Title: Re: Homing
Post by: DazTheGas on September 04, 2015, 11:50:39 AM
The posted log is showing the estop etc,

With the log being outputed start up the machine, and click home all axis. Then we can see only what has been run in the api and motion controller befor it hangs.

The thing we need to discover is if there is something else that is causing the hang.

DazTheGas
Title: Re: Homing
Post by: dude1 on September 04, 2015, 05:30:25 PM
set all other axis to home in place, then run just the A mapped as Y with no code, then with your code keeping a copy of the log each time, doing that way will show if it can be done with out code and what does or does not go wrong. same with running your code.

then the code can be compared, everything has a order to it where that order goes wrong is what is need that`s why the logging is used to find where it`s going wrong.

on what was in the log you posted it showed something when`t wrong but it had the other axis in it and calling of your code you can see where the estop was hit but it carried on if you run the code what daz posted it will still put a log out even with it crashing
Title: Re: Homing
Post by: Chaoticone on September 04, 2015, 05:52:50 PM
Why not turn on logging and then go to the Machine Diagnostics page and just reference the A axis? You can reference axis individually on the diagnostics page.
Title: Re: Homing
Post by: dude1 on September 04, 2015, 07:18:15 PM
thanks Chaoticone did not think of that one.

KingKerf please try that
Title: Re: Homing
Post by: Chaoticone on September 04, 2015, 08:47:41 PM
No problem Daniel.
Title: Re: Homing
Post by: dude1 on September 04, 2015, 09:23:33 PM
Chaoticone I see there is a new version out they have not got the test screen set you did for the default screen in it.
Title: Re: Homing
Post by: Chaoticone on September 04, 2015, 09:43:42 PM
Yup, we still have work to do on the screen but it is getting close.
Title: Re: Homing
Post by: DazTheGas on September 05, 2015, 05:18:44 AM
Check your Mach config, A axis is set to home last, although in the input signals there is nothing set for Motor 3 Home.
This could mean that motor 3 is homing as should but it does not back off to complete the cycle.

DazTheGas
Title: Re: Homing
Post by: KingKerf on September 08, 2015, 10:07:54 AM
I am using a custom built screen that doesn't have the same diagnostics page. And the homing order will never matter because I am calling each axis to home individually and not using mc.mcAxisHomeAll().
Title: Re: Homing
Post by: KingKerf on September 08, 2015, 03:15:25 PM
Also Daz,
If you read farther up in the topic, Motor 3 is set to the Y axis, which is set to Home-in-place. The A axis is motor 1.
Title: Re: Homing
Post by: DazTheGas on September 08, 2015, 03:19:20 PM
Away at moment but will read posts from begining and see if between us we can get you right.

DazTheGas
Title: Re: Homing
Post by: dude1 on September 08, 2015, 03:26:10 PM
your log shows homing axis letter and axis numbers at the same time if you home A axis only as motor 1 what happens, the motor numbers are the mapping function across all plugins`s Mach4 does not give a ********* what axis letter is set to a axis number as this is just the mapping of motor`s.

your problem is A axis so just run that by it self once you have done that a put up the logging, we can see what is going on with that motor then go from there
Title: Re: Homing
Post by: Chaoticone on September 09, 2015, 09:30:51 AM
I would also see if it has the same problem with all things default or as close as possible to default. Screens, profile, etc.
Title: Re: Homing
Post by: polzsp on October 24, 2015, 03:48:48 PM
Hello,
   I am a newbie to the Mach4 CNC community (~5 months) and have a simple cnc mill that operates pretty well for the most part.  Unfortunately, I  have been trying to solve the same problem as kingkerf from the beginning of my cnc build. I've tried multiple versions of Mach4, and updated ESS plugins as recommended. Regardless of what I have tried,  I am having the same problem that kingkerf explained with my mill. My slaved y axis behaves as expected, but my x, and z axis simply shut down once the limit switch is activated. All limit switches behave just fine under normal operating conditions.  Based on your previous advice, I have logged and attached the homing data files for the y, x, and z axes. The work and advice offered on this forum is outstanding and any help you may be able to offer would be appreciated. I am currently running Mach4 version 2763 using ESS plugin build 132. Finally, I would like to state that I am a HUGE fan of the videos that DaztheGas has provided. The videos expedited my build time tremendously - thank you.  ;D
Title: Re: Homing
Post by: polzsp on October 25, 2015, 12:23:33 PM
I noticed something strange while trying to home the z Axis while logging the action. It occurred after I re-enabled Mach4 after the z axis home sequence shut down. What is strange is that after enabling the system the code for the homing sequence seemed to complete as expected and matched the code sequence on my functional y axis - nothing physically moved on my mill. I have attached a file with this information for reference.
Title: Re: Homing
Post by: KingKerf on October 26, 2015, 09:18:46 AM
I never found or was supplied a solution to my homing issue. I was in contact with the Tech9 support and they are also aware of the issue. The only thing that solved my problem was to use Mach3 and not Mach4.
Title: Re: Homing
Post by: polzsp on October 27, 2015, 05:32:13 PM
Thanks for the update KingKerf.  I'm hoping the upcoming plugin will fix this problem.
Title: Re: Homing
Post by: dude1 on October 27, 2015, 05:51:49 PM
polzsp can you put up screenshots of your ESS settings and the M4 input setting for homing and for your M4 estop setting

also have you seen what DazTheGas has done on you tube 
Title: Re: Homing
Post by: polzsp on October 27, 2015, 06:22:42 PM
I've attached my ess homing inputs and mach4 homing, soft limits, and e-stop settings.  To answer your last question, yes I have been following and signed up for DazTheGas's youtube site - he creates some excellent videos. I haven't been back to visit his site since Sunday. Thanks for your time blockhead.....
Title: Re: Homing
Post by: polzsp on October 27, 2015, 06:24:39 PM
oops forgot to post ess settings - please see attached.

Title: Re: Homing
Post by: dude1 on October 27, 2015, 06:48:03 PM
ok motor 0 is x, motor 1 is y, motor 2 is z and motor 4 is A what I take is your slave for a start

you have -- and ++ for home thats your limits not home you are confusing mach you need to watch the ESS set up vids

Title: Re: Homing
Post by: polzsp on October 27, 2015, 07:04:58 PM
I'll review the setup videos again and compare against my system. Just for reference, I've also included a screen shot of my mach4 axis mapping. Thanks for your time blockhead.
Title: Re: Homing
Post by: dude1 on October 27, 2015, 07:18:13 PM
yep if you look at you pick you have X(0) what is X axis as motor 0, then you have it set as motor2 what is Z

then Y is correct with your slave as Motor0 what is the X axis

Z what is motor 2 you have it set as motor3 what is A axis

this is wrong you need to have everything set a certain way for the mapping to work other wise M4 will not work correctly at all
Title: Re: Homing
Post by: polzsp on October 27, 2015, 07:55:47 PM
blockhead......YOU ROCK!!!!!!!! That fixed my problem - I can't believe I didn't see that earlier. Thank you very, very, very, much!!!!!
Title: Re: Homing
Post by: dude1 on October 27, 2015, 08:26:35 PM
no problem happy it is working for you