Adjusting maxvel stops my routine

  • JetForMe
  • JetForMe's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
02 Sep 2024 22:14 #309236 by JetForMe
Adjusting maxvel stops my routine was created 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:
    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.
Attachments:

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

More
03 Sep 2024 05:21 #309259 by cmorley
Replied by cmorley on topic Adjusting maxvel stops my routine
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 or Create an account to join the conversation.

More
03 Sep 2024 07:17 #309269 by Aciera
Replied by Aciera on topic Adjusting maxvel stops my routine
I would try to use custom Mcodes/ subroutines directly and avoid using the python mdi command.

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

  • JetForMe
  • JetForMe's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
03 Sep 2024 23:57 #309311 by JetForMe
Replied by JetForMe on topic Adjusting maxvel stops my routine

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 or Create an account to join the conversation.

More
04 Sep 2024 05:59 - 04 Sep 2024 06:37 #309336 by Aciera
Replied by Aciera on topic Adjusting maxvel stops my routine
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
Last edit: 04 Sep 2024 06:37 by Aciera.

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

Time to create page: 0.053 seconds
Powered by Kunena Forum