Error: Calling a remapped M6 toolchange from a remapped cycle

More
26 Sep 2017 20:56 #99492 by terans1085
Hello,

I am currently in the process of implementing an automatic tool changer to my setup (3 axis router), hence the need to remap M6. I decided to go for an all python approach:

REMAP=M6 modalgroup=6 python=m6

Toolchanging works fine when called from MDI, however an error "Bug: call stack underrun" is happening when a Txx M6 is called from another remapped cycle, also implemented in python:

REMAP=G81.5 modalgroup=1 python=g815

Would you have any insight about this? Thank you for your time :)

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

More
28 Sep 2017 15:18 #99558 by terans1085
So I have decided to rewrite the G81.5 cycle, but this time in gcode, and remapped as G81.4, using the default cycle prolog and epilog. Works perfectly except when an M6 is called, this I'm getting an error as per attached image.

Seems like it is looking for an o<m6> subroutine, but frankly I don't know where to put it given that I have remapped M6 entirely in python.
Attachments:

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

More
03 Oct 2017 21:25 #99855 by andypugh
That is a bit strange. Are you sure that there isn't an ngc=m6 anywhere in your config by mistake?

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

More
04 Oct 2017 04:50 #99893 by terans1085
There is, but it is commented behind #, as all comments go! I will try deleting completely but I have little faith this is the issue

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

More
04 Oct 2017 10:08 #99908 by andypugh
Don't bother, commented out is commented out.

You might get a better answer from the Machinekit guys, the chap who wrote the remap code hangs out there now.

It might just be that you can't nest remaps, or that the remapped code needs to be on the top level.
(Perhaps you can call the python part of the remap from G-code as a custom M-code?)

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

More
04 Oct 2017 12:44 #99919 by bevins
The interpreter is very finicky when it comes to remapping in python. First it cannot run three python scripts in a row. When it does its read ahead and tries to run a remap inside another remap how will the interpreter get back? I don't think you can do that. It think Michael will tell you the same thing. Not sure.

What happens if you try and add the remap code in the G81.5 remap. Also try just running Tx in the remap and see if the bug is coming from the Tx or the M6. If it is coming from the M6, then you can run the Tx get the selected tool and hard code the toolchange in the G87

Just a thought.

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

More
10 Oct 2017 05:20 #100134 by terans1085
So what I have done as an interim (possibly permanent) solution is, nest functions rather than remaps.

def m6(self):
if m6func(self) == 1: return INTERP_OK

def m6func(self):
**all m6 code, returning a 1 rather than an INTERP_OK**

Calling m6func(self) directly from the G81.5 remap went well so far. Also I have been reading some of Bevins' threads about his remap. I have not been able to grasp the concept of "yield INTERP_EXECUTE_FINISH", did not notice any difference so far.

Would it be rude if I ask you to have a look at your actual M6 remap python code? as I could not find on the posts.

Thanks a lot for your time!! :)

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

More
10 Oct 2017 22:25 #100168 by bevins

So what I have done as an interim (possibly permanent) solution is, nest functions rather than remaps.

def m6(self):
if m6func(self) == 1: return INTERP_OK

def m6func(self):
**all m6 code, returning a 1 rather than an INTERP_OK**

Calling m6func(self) directly from the G81.5 remap went well so far. Also I have been reading some of Bevins' threads about his remap. I have not been able to grasp the concept of "yield INTERP_EXECUTE_FINISH", did not notice any difference so far.

Would it be rude if I ask you to have a look at your actual M6 remap python code? as I could not find on the posts.

Thanks a lot for your time!! :)


I posted it in another posr last week i think, but i,ll post it here when i get to the shop tonight.

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

More
10 Oct 2017 23:48 #100184 by bevins
my remap file. I have an xml class in there, so just blow by that.

I had to change the py extension to .hal so the forum would take it.
Attachments:
The following user(s) said Thank You: terans1085

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

More
18 Oct 2017 16:46 #100516 by terans1085
I have been going through your code, and noticed you use yield INTERP_EXECUTE_FINISH inside function queuebuster(), but never make any call to that. And when I did call, didn't work in my case.

**Might be moving on to something different here, dunno if I should open a new thread....**

I have finally managed to get my remapped M6 somewhat working, BUT, when a gcode file with multiple toolchanges is run, readahead is setting global variables and parameters (from my epilog) way before the next toolchange happens. So if the program is stopped at any point, the machine thinks that the "next" tool is loaded.

Using yield INTERP_EXECUTE_FINISH directly in my remapped m6() produced erratic results, like having linuxcnc open axis.ngc (default).

Any ideas about a workaround??

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

Time to create page: 0.078 seconds
Powered by Kunena Forum