Hello Guest it is March 28, 2024, 08:47:17 AM

Author Topic: Reference all home help.  (Read 11211 times)

0 Members and 1 Guest are viewing this topic.

Re: Reference all home help.
« Reply #50 on: December 04, 2017, 04:27:41 PM »
I have since went to the machine and and confirmed what you had mentioned! Having the home switch outside the soft limits was causing problems! I have since switched x min soft limit to 0 and can now run the "to center" code as expected with soft-limits enabled right out of the gate! Clicking the machine coordinates helped with seeing what was going on!  :) 
Re: Reference all home help.
« Reply #51 on: December 04, 2017, 05:21:46 PM »
Hi,
kool, life is one big learning experience.

I recall it took a long time for me to get fixed in my mind the difference between machine co-ordinates and those functions
which are implemented in terms of machine co-ordinates and work co-ordinates. Its not so much that I'm a slow learner
but just a quick forgetter!

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Reference all home help.
« Reply #52 on: December 04, 2017, 05:36:59 PM »
hahah "quick forgetter" thats funny! With the current "to center" code and my new changes to the softlimits, i have tested different values, tried different combinations to make it do something odd or miss behave. I feel comfortable and want to make your code execute automatically after the "reference all button" is clicked. How can i call the "GoCenter()" function automatically in the reference all script? ....

Can i add something to the REF all home function to call the "GoCenter()" function and make it happen in one fell swoop?

---------------------------------------------------------------
-- Ref All Home() function.
---------------------------------------------------------------
function RefAllHome()
    mc.mcAxisDerefAll(inst)  --Just to turn off all ref leds
    mc.mcAxisHomeAll(inst)
    coroutine.yield() --yield coroutine so we can do the following after motion stops
    ----See ref all home button and plc script for coroutine.create and coroutine.resume
   
--
    wx.wxMessageBox('Referencing is complete')
end


Re: Reference all home help.
« Reply #53 on: December 04, 2017, 06:01:07 PM »
Hi,
yes you can add it to the RefAllHome() function, I would put GoCenter() just before the message box.

The advantage of having the GoCenter function code in the screen load script is that it is visible
throughout the Mach GUI and is therefore perfectly permissable to call it from another function, in this case
RefAllHome(). Not sure how the coroutine part would affect it. Note that the screen button will work per normal,
there is no need to disable it.

Try it and see.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Reference all home help.
« Reply #54 on: December 04, 2017, 06:49:38 PM »
Quote
Not sure how the coroutine part would affect it

You will want to add it after the coroutine so it goes to center after homing is complete.

The coroutine and message box was added to the ref all home to be an example of how coroutines can work. They are nice to hold things up until a certain point is reached then continue from there. Without the coroutine the message box would pop up immediately when the RefAllHome function was called (instead of after motion stops after all referencing is complete).
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Reference all home help.
« Reply #55 on: December 04, 2017, 07:47:05 PM »
Hi Chaoticone,
I've always avoided the investment in thinking to allow me to make any real sense of co-routines...looks like
that particular 'blissful ignorance' is under assault!

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Reference all home help.
« Reply #56 on: December 04, 2017, 08:36:16 PM »
Chaoticone and Joeaverage hello! Thanks for all the feed back and assistance =)  Doing some searching and playing around with the co-routine in the screen load. placing GoCenter() in the ref all causes like you said for the reference complete message to pop up before the x,y move is complete... Im sure its something very obvious  ;)  but unlike Craig my ignorance is less blissful  ;D  Is it a simple matter of placing the code correctly in the ref all.

- Nick
Re: Reference all home help.
« Reply #57 on: December 04, 2017, 08:41:46 PM »
Hi Nick,
that is what I expect, the machine has to reference and the message 'Referencing Complete' is appropriate
BEFORE the GoCenter() function even starts.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Reference all home help.
« Reply #58 on: December 04, 2017, 09:07:25 PM »
Chaoticone and Joeaverage hello! Thanks for all the feed back and assistance =)  Doing some searching and playing around with the co-routine in the screen load. placing GoCenter() in the ref all causes like you said for the reference complete message to pop up before the x,y move is complete... Im sure its something very obvious  ;)  but unlike Craig my ignorance is less blissful  ;D  Is it a simple matter of placing the code correctly in the ref all.

- Nick

Just add another coroutine.yield

function RefAllHome()
    mc.mcAxisDerefAll(inst)  --Just to turn off all ref leds
    mc.mcAxisHomeAll(inst)
    coroutine.yield() --yield coroutine so we can do the following after motion stops
    ----See ref all home button and plc script for coroutine.create and coroutine.resume
    --Do your moves here
     coroutine.yield()
--
    wx.wxMessageBox('Referencing is complete')
end

Hi Chaoticone,
I've always avoided the investment in thinking to allow me to make any real sense of co-routines...looks like
that particular 'blissful ignorance' is under assault!

Craig

 ;D
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Reference all home help.
« Reply #59 on: December 04, 2017, 10:08:25 PM »
why not just move the home switch to the center of the table, like an old MAG VMC? Not sure why you want it to move to center, just for easy loading? My giant VMC has a 30x60 table and homes far back right corner, so a G98.1 X30 Y30 brings it front and center.