Python toolchanger, problem while loading program

More
07 Aug 2018 18:06 #115762 by emcPT
Hello,

I am working on a python tool changer project that is mostly already doing what we wanted. In fact we were already saying that it is ready as we tested several time with MDI mode.
When preparing gcode to test the tool changer in a repeat manner, we found that any gcode file during load though errors that are present on the python tool changer. It looks like the preview runs the toolchanger (that makes sense). However there are conditions that are not meet during the load of a file that are effective errors if the tool changer is really called.

To avoid this error I have tested several things including trying to get the linuxcnc.status or mode, without success, so that in python the tool changer routine is aborted if the machine is not running in AUTO or MDI.
Any ideia to overcome this problem?

Please Log in or Create an account to join the conversation.

More
07 Aug 2018 19:04 - 07 Aug 2018 19:14 #115765 by bevins
I use this in my M6 remap to get the mode.
I used it when building and troubleshooting python remap. I pulled it from the code but the function is still there.


Warning: Spoiler!


Warning: Spoiler!
Last edit: 07 Aug 2018 19:14 by bevins.

Please Log in or Create an account to join the conversation.

More
07 Aug 2018 19:11 #115766 by bevins
Forum wont take my function. Says too many links in message, please decrease them.
So I have to split it up.

Warning: Spoiler!
The following user(s) said Thank You: emcPT

Please Log in or Create an account to join the conversation.

More
08 Aug 2018 11:47 #115803 by emcPT
Thank you.
We were not able to use your function as the return state during a MDI code or for example a touch off where the same, and during the touch off the routine trigger a error.
Or solution was to implement on the top of the python file a verification check for a digital pin that we know that is always "1". If it would be impossible to fetch the status of the pin or returned a value different than "1", it means that the python toolchanger script could not be used and returned without any toolchange.

Please Log in or Create an account to join the conversation.

More
08 Aug 2018 15:08 #115813 by bevins

Thank you.
We were not able to use your function as the return state during a MDI code or for example a touch off where the same, and during the touch off the routine trigger a error.
Or solution was to implement on the top of the python file a verification check for a digital pin that we know that is always "1". If it would be impossible to fetch the status of the pin or returned a value different than "1", it means that the python toolchanger script could not be used and returned without any toolchange.


Whats driving that pin?

Please Log in or Create an account to join the conversation.

More
08 Aug 2018 18:28 #115826 by emcPT
The pin that we added to test?
We set it on hal to be true, always.

Please Log in or Create an account to join the conversation.

More
08 Aug 2018 22:42 #115833 by cmorley
The following user(s) said Thank You: emcPT, jtc

Please Log in or Create an account to join the conversation.

More
12 Aug 2018 14:53 #115963 by emcPT
Yes it is relevant. I did not tested, but it looks that is the correct way to do it.
Thank you

Please Log in or Create an account to join the conversation.

More
13 Aug 2018 12:06 #115998 by bevins
Are you checking which mode your in in your remap file?

I do it like this.... first thing to do in remap file, that will exit if in preview. If in milltask, it will run your code.
if self.task==0:
        return INTERP_OK

Please Log in or Create an account to join the conversation.

Time to create page: 0.239 seconds
Powered by Kunena Forum