Adjusting maxvel stops my routine

More
2 years 1 month ago #309236 by JetForMe
I'm trying to write a g-code subroutine to surface my router table. I've attached the file. I'm running into all sorts of weird issues, but the current one is that if I adjust the Max Velocity while it's running, it just stops with wait_command() returning 1.

I'm calling it with this:
Code:
    def surfaceTable(self,widget,data=None):         print("surfaceTable called")         if mdiOK():             saveMode = sStat.task_mode             saveCoordinates = sStat.g5x_index             print("Current coordinate system: ", saveCoordinates)             sCommand.mode(linuxcnc.MODE_MDI)             sCommand.wait_complete()             sCommand.mdi("o<surface> call")             result = sCommand.wait_complete(10 * 60)             print(f"surface call wait result: {result}")             sCommand.mode(saveMode)             print("surfaceTable finished")

I really struggle to understand why calling a subroutine is so different from executing a loaded g-code file.

Please Log in to join the conversation.

More
2 years 1 month ago #309259 by cmorley
Wait_complete monitors linuxcnc status for the current message serial number.
It only checks if the current serial number is _past_ the commanded message serial number.

My educated guess is that since adjusting the maxvelocity sends more commands, the serial number gets changed and the check passes, even though it's the max velocity not the MDI that finished.

Using MDI programmatically is very difficult.

Please Log in to join the conversation.

More
2 years 1 month ago #309269 by Aciera
I would try to use custom Mcodes/ subroutines directly and avoid using the python mdi command.

Please Log in to join the conversation.

More
2 years 1 month ago #309311 by JetForMe

I would try to use custom Mcodes/ subroutines directly and avoid using the python mdi command.
 
Can you elaborate on how to do that? I'm invoking these from a VCP, buttons bound to Python code.

Please Log in to join the conversation.

More
2 years 1 month ago #309336 by Aciera
Linuxcnc has buttons for GTK3 and PyQt5 that can be connected to [HALUI] MDI_COMMANDS in hal:
linuxcnc.org/docs/stable/html/gui/halui.html#_mdi_2
www.forum.linuxcnc.org/38-general-linuxc...halui-section#307456
For example panels see:
configs/sim/axis/gladevcp/
configs/sim/axis/qtvcp/
and others.

[edit]
If you are not using any of the above libraries you can also create hal pins through the python halmodule:
linuxcnc.org/docs/devel/html/hal/halmodule.html

Please Log in to join the conversation.

Time to create page: 0.079 seconds
Powered by Kunena Forum