(RESOLVED) Remapping M6 - I am having issues

More
31 Mar 2017 11:17 - 10 Apr 2017 15:00 #90634 by bevins
Hi,

We have written a remap of M6 and it is working in preview instance. Wrote it while in preview without testing self.task so it ran as soon as we loaded LCNC for easy debugging. This I thought would be ok except now I am finding the two instances don't act the same. I could never get self.execute to work ever. even a simple 5 liner remap would not move the axis's, so I reverted to mdi mode for moving. That worked and everything is ok except after adding the self.task check and exiting the remap when in preview mode everything worked up until I ran the program. Then I got errors. Apparantly cannot activate digital outs and read digital ins while in auto mode. Am I suppose to switch to manual mode during a remap and switch back to auto?

I know I have made some fundamental errors but I cannot recover from it. I would need a little guidance please.....

Had to change the py ext to txt because the forum wont allow it.



Attachments:
Last edit: 10 Apr 2017 15:00 by bevins.

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

More
31 Mar 2017 11:26 - 04 Apr 2017 02:50 #90635 by bevins
The code before did not work. I have the remap figurd out now and will uplaod an example her of a completed toolchange remap m6 in pure python.
Attachments:
Last edit: 04 Apr 2017 02:50 by bevins.

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

More
01 Apr 2017 12:58 #90697 by bevins
Attached is the console out with DEBUG turned on max....
Attachments:

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

More
04 Apr 2017 12:36 #90864 by andypugh
Is it working now, or not?

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

More
10 Apr 2017 14:50 - 10 Apr 2017 15:18 #91126 by bevins

Is it working now, or not?


I have adapted the programming to sooth the behavour of the interpreter, so it doesnt complain.
I cannot call a function from within a function, this does not work. I dont know if this is a bug or the issues relateed with
behaviour of the interpreter. If I do not call a function from within a function everything works. I have to use the INTERP_EXECUTE_FINISH or the interpreter ignores the commands and all hell breaks loose.

I yeild the INTERP_EXECUTE_FINISH in a function that was called from another function then return back to the calling function and INTERP_EXECUTE_FINISH, that is not working. But I got around it by changing the logic of the main program and all is working.

All the moves and input checking and output setting is done with self.execute("GCODE"), and it works extremely well. I added a couple functions in a spoiler so you can see.

The trick is to keep the interpreter happy. The docs make it sound like when doing a remap just tell the interpreter to yield, then end with syncing the interpreter. That does not work. When calling a function, you need to make sure before you return to the main program you sync the interpreter. That is the only way I got it to work.

You cannot return anything within the function either. It does not work. The docs supports this also.

I am continuing to test entering and exiting functions until I find the way to do it, if it is possible to do at all.

But it works extremely well.

Warning: Spoiler!


If you stay within the realms of the interpreter, you shouldnt have no problems. The interpreter does what it is designed to do really well.

I will upload a remap all in python, I will remove all my xml and auto stufrf so ti will be easy to see,.
Last edit: 10 Apr 2017 15:18 by bevins.

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

More
10 Apr 2017 15:15 - 10 Apr 2017 15:16 #91128 by bevins
One other thing you must have to make it work is the self.task check.

You have to check self.task is in the milltask instance or the preview instance and exit if it is in preview or else it will run your remap.

I do this at the beginning of remap file.

if self.task==0:
return INTERP_OK

What happens is when LinuxCNC starts up it is using the preview instance of the interpreter, so it can load the file and display it in the GUI.

So when you do your remap, if it is in preview you exit, otherwise your using the milltask instance.
When you run the program from within the GUI, you are using the milltask instance and it runs your gcode.

I hope I explained it correctly.
Last edit: 10 Apr 2017 15:16 by bevins.
The following user(s) said Thank You: JohnnyCNC

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

More
11 Apr 2017 13:51 - 11 Apr 2017 15:27 #91184 by bevins
Still have some timing tweaks but it is close....

Last edit: 11 Apr 2017 15:27 by bevins.

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

Time to create page: 0.241 seconds
Powered by Kunena Forum