Does the interface display abnormally when using External Axis Offsets?

  • chen1234
  • chen1234's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
10 Feb 2022 09:46 #234479 by chen1234
Hi all, I have a problem and hope someone can help me.
I judge by receiving the input IO signal on the EtherCAT board (when there is a high level, it will trigger the Z-axis feed).
When I was testing, I found that: after receiving the signal, the Z axis will feed, but the position of the Z axis will not be refreshed on my UI interface.
My Z-axis feed is triggered by signals and signal slots, and receiving signals is in a separate thread. The interface is not stuck when executing the (.ngc) file, but the display part of the interface will not display the position of the Z-axis in real time, and will display the final position after completing the feed.
I don't understand that there is a problem with that part, I try to modify different ways (to do it in a remap script, or in python code using communication).
I use pyQt5 and linuxcnc2.9.
Thanks in advance, my configuration and code are as follows:
ini:
[PYTHON]
TOPLEVEL = /home/xhiqi/linuxcnc-dev/configs/sim/qtvcp_screens/python/toplevel.py
PATH_APPEND = /home/xhiqi/linuxcnc-dev/configs/sim/qtvcp_screens/python
[RS274NGC]
SUBROUTINE_PATH = ./examples
PARAMETER_FILE = xyzac.var
SUBROUTINE_PATH = /home/xhiqi/linuxcnc-dev/configs/sim/qtvcp_screens/python
REMAP=M203 modalgroup=10 argspec=P python=m203        #read in5 

[AXIS_Z]
       MIN_LIMIT = -120
       MAX_LIMIT =  120
    MAX_VELOCITY =   100
MAX_ACCELERATION =  300
OFFSET_AV_RATIO  =   0.2

.hal
setp axis.z.eoffset-enable 1
setp axis.z.eoffset-scale 1

remap.py
def m203(self,**words):
    yield INTERP_EXECUTE_FINISH
    if self.task:
        print('read scanning head feed signal')
        a = (str)(words['p'])
        while 1 :
            y = hal.get_value('lcec.0.5.RXPDO-4')  
            if y == 1: 
                main = "/home/xhiqi/linuxcnc-dev/nc_files/e1803/M203_SH"  #Transfer feed parameters through shared memory
                os.system(main +' '+ a)  

            elif y == 0 or hal.get_value('lcec.0.5.TXPDO-2') == 1:
                time.sleep(0)
                break 
ui.py
_thread.start_new_thread(self.read_m203,())
#--------Signal and signal slot for processing z-axis feed------
class FeedLength(QWidget):
    mySignal_1 = pyqtSignal()      
    def __init__(self):
        super(FeedLength, self).__init__()
        self.mySignal_1.connect(self.Slot_mySignal_1)

    def Slot_mySignal_1(self):  
        hal.set_p("axis.z.eoffset-counts","%d"%Feed_Length)

    def Send_signal(self):       
        self.mySignal_1.emit()

#-----Read the size of one feed and trigger the signal --------
def read_m203(self):
      global  Feed_Length = 0
      while 1:
       try:
          a = os.popen('/home/xhiqi/linuxcnc-dev/nc_files/e1803/M203_RE')  #Receive feed parameters passed from shared memory
          b =a.read()
          c = int(float(b))
          Feed_Length = c
          e = 0
          while 1:
              #time.sleep(0.0001)
              y = hal.get_value('lcec.0.5.RXPDO-4')  
              if y==1: 
                x = hal.get_value('lcec.0.5.RXPDO-5')  
                if x==1:
                    while 1:
                        #time.sleep(0.2)
                        x = hal.get_value('lcec.0.5.RXPDO-5')  #When the high level of in5 is read once, the z-axis feed signal is triggered once
                        if x==0:
                           e += 1
                           self.FeedLength.Send_signal()
                           Feed_Length += c
                           break
                    
              if y==0: 
                Feed_Length = 0
                self.FeedLength.Send_signal()
                print('e = ',e)
                break
         
       except:
         time.sleep(0)
       
 

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

More
10 Feb 2022 09:57 #234481 by rodw
 I might be wrong but I think external offsets is external to the motion planner so it not shown in the DRO's
Anyway, thats how I thought it worked way back when it was released.

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

  • chen1234
  • chen1234's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
10 Feb 2022 10:20 - 10 Feb 2022 10:24 #234483 by chen1234
I saw in the example sim/configs/axis/external_offsets/eoffsets_demo.ini that when External Axis Offsets is triggered, the interface will display the position of the Z axis synchronously.
linuxcnc.org/docs/2.8/html/motion/extern...l#_eoffsets_demo_ini
 
Attachments:
Last edit: 10 Feb 2022 10:24 by chen1234.
The following user(s) said Thank You: rodw

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

Time to create page: 0.092 seconds
Powered by Kunena Forum