Using remapping code will cause the G code to jump to execute?

More
4 years 10 months ago #229111 by chen1234
I have defined multiple remapping codes (M702 is used to set the parameters of external devices, and M200 is used to receive ethercat's io signal and control the movement of the Z axis).
I use (yield INTERP_EXECUTE_FINISH) in the remapping code, which allows my code to be executed sequentially in the file, but when I tested it, I found that only the M702 defined by me would not destroy the G code file.
When using other remapping codes Line skipping will occur (for example, skip the line of G code before M200 when using M200).
Is there a problem with the use of the (yield INTERP_EXECUTE_FINISH) function?
How can I solve it? I use Linuxcnc 2.9
Thank you in advance for any reply.
 Below is part of my code and configuration:
remap.py
Code:
#!/usr/bin/env python3 import sys  import os from interpreter import * from emccanon import MESSAGE import re import math import hal import linuxcnc import time import thread def m200(self,**words):     yield INTERP_EXECUTE_FINISH      if self.task:         a = int(words['p'])         print('a=',a)         x = hal.get_value(lcec.0.5.TXPDO-0)                 print("xr ==",x)         if x == 1:             self.execute("G0 Z %d"%a)             print("MDI_Xxxxx") def m702(self, **words):     yield INTERP_EXECUTE_FINISH      if self.task:             list = []             for key in words:                 print("word '%s' = %f" % (key, words[key]))                 list.append(key+str(words[key]))             res=str(list[0]+' '+list[1]+' '+list[2])             print ('res=',res)             i=0             while i <= 2:                 x=list[i].find("f")                 if x != -1:                         a = re.sub('[a-zA-Z]',"",list[i])                 y=list[i].find("p")                 if y != -1:                         b = re.sub('[a-zA-Z]',"",list[i])                 z=list[i].find("q")                 if z != -1:                         c = re.sub('[a-zA-Z]',"",list[i])                              i+=1             par = str(a+' '+b+' '+c)             print ('parameters=',str(a+' '+b+' '+c))             #main = "/home/.../.../aa"  #Executable              #os.system(main +' '+ par)
ini
Code:
[PYTHON] TOPLEVEL = /home/.../linuxcnc/configs/sim.axis/python/toplevel.py PATH_APPEND = /home/.../linuxcnc/configs/sim.axis/python [RS274NGC] # File containing interpreter variables PARAMETER_FILE = sim.var SUBROUTINE_PATH = /home/.../linuxcnc/configs//python REMAP=M702 modalgroup=10 argspec=FPQ python=m702 REMAP=M200 modalgroup=10 argspec=P python=m200
ngc
Code:
G90 G17 G21 G64 p0.001 F1000 G1 x10 y10 z0 G1 x10 y-10 z0 G1 x0 y0 z0  ;M702 F20 P50 Q1    M200 P-5         ;remap code G2 i5 j0 f1000 M2
 

Attachment not found

 

Attachment not found

Please Log in to join the conversation.

More
4 years 10 months ago #229117 by tommylight
Second topic with the same subject ?

Please Log in to join the conversation.

More
4 years 10 months ago #229124 by cmorley
starting the remap with 'yield INTERP_EXECUTE_FINISH ' does nothing.
This command should be called _after_ you add your code that needs to wait for events. (such as probing or reading HAL pins)

Please Log in to join the conversation.

Time to create page: 0.085 seconds
Powered by Kunena Forum