self.command.mdi() - without self.command.wait_complete()

  • zz912
  • zz912's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
15 Jun 2023 06:22 #273573 by zz912
Hello,

I found: 
github.com/LinuxCNC/linuxcnc/blob/67b814...ccapy.py#L4285-L4291
    def on_btn_zero_g92_clicked(self, widget, data=None):
        self.command.mode(linuxcnc.MODE_MDI)
        self.command.wait_complete()
        self.command.mdi("G92.1")
        self.command.mode(linuxcnc.MODE_MANUAL)
        self.command.wait_complete()
        self.widgets.btn_touch.emit("clicked")

I think self.command.wait_complete() is missing here.
I think it should look like this:
    def on_btn_zero_g92_clicked(self, widget, data=None):
        self.command.mode(linuxcnc.MODE_MDI)
        self.command.wait_complete()
        self.command.mdi("G92.1")
        self.command.wait_complete()
        self.command.mode(linuxcnc.MODE_MANUAL)
        self.command.wait_complete()
        self.widgets.btn_touch.emit("clicked")

Is it a bug?
Can be self.command.mdi() without self.command.wait_complete()

The same situation is also here:
github.com/LinuxCNC/linuxcnc/blob/67b814...ccapy.py#L4324-L4331
github.com/LinuxCNC/linuxcnc/blob/67b814...ccapy.py#L4342-L4346
github.com/LinuxCNC/linuxcnc/blob/67b814...ccapy.py#L4404-L4410

Maybe here:
github.com/LinuxCNC/linuxcnc/blob/67b814...ccapy.py#L3010-L3018
github.com/LinuxCNC/linuxcnc/blob/67b814...ccapy.py#L4960-L4964
github.com/LinuxCNC/linuxcnc/blob/67b814...py/gmoccapy.py#L4987

 

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

More
15 Jun 2023 06:30 #273575 by rodw
I don't think its an issue but I don't know the Python interface.
to my knowledge, Gcodes are buffered so it makes sese to me to only wait after the last gcode command (eg wait for the buffer to empty).
The following user(s) said Thank You: zz912

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

  • zz912
  • zz912's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
15 Jun 2023 06:49 #273576 by zz912
For example here, it is written as I think it is correct.
github.com/LinuxCNC/linuxcnc/blob/67b814...ccapy.py#L4933-L4942

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

  • zz912
  • zz912's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
15 Jun 2023 07:14 #273578 by zz912

I don't think its an issue but I don't know the Python interface.
to my knowledge, Gcodes are buffered so it makes sese to me to only wait after the last gcode command (eg wait for the buffer to empty).

Waiting for buffer to empty is very important. I think.

In this case:
github.com/LinuxCNC/linuxcnc/blob/67b814...ccapy.py#L4285-L4291
github.com/LinuxCNC/linuxcnc/blob/67b814...ccapy.py#L4324-L4331
github.com/LinuxCNC/linuxcnc/blob/67b814...ccapy.py#L4342-L4346
github.com/LinuxCNC/linuxcnc/blob/67b814...ccapy.py#L4404-L4410
After self.command.mdi() is immidietaly change mode from MDI mode.

In this case:
github.com/LinuxCNC/linuxcnc/blob/67b814...ccapy.py#L3010-L3018
github.com/LinuxCNC/linuxcnc/blob/67b814...ccapy.py#L4960-L4964
github.com/LinuxCNC/linuxcnc/blob/67b814...py/gmoccapy.py#L4987
After self.command.mdi() could be change mode from MDI mode. I don't know what will happen next.

Here:
linuxcnc.org/docs/2.9/html/config/python...ing_to_send_commands
is written: "the mode is set to MDI mode"

I am currently working on this bug:
github.com/LinuxCNC/linuxcnc/issues/2453
I don't think the bug will be fixed by fixing these cases, but it might prevent similar problems in the future.

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

More
16 Jun 2023 05:21 #273678 by newbynobi
I have played in the past a lot with the command_wait_complete, and found that it had no effect to the GUI reactions, but that was in gmoccapy 1

So it might be worse to try with the actual code to add in all the mentioned cases the complete command.
If you have done that, just do make and please report back!

Norbert
The following user(s) said Thank You: zz912

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

More
16 Jun 2023 06:07 #273682 by cmorley
adding wait_complete before switching back to manual sounds right to me. Not doing it looks like a race condition to me.

Also I vaguely remember having a problem if I requested a mode that linuxcnc was already in.
It would cause odd problems that I now can't remember the details of.
I copied a function (from gladevcp) to checks the current mode and only changes it if required (and it waits for it to complete)
The following user(s) said Thank You: zz912

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

  • zz912
  • zz912's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
16 Jun 2023 06:21 #273684 by zz912
Thanks for the responses. I will complete the commands and give feedback.

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

  • zz912
  • zz912's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
18 Jun 2023 12:50 #273776 by zz912
Hello,

I wanted to start experimenting with the self.command.wait_complete() function
I wanted to use the cooling button.
I added the following lines to the source code:

             self.command.mode(linuxcnc.MODE_MDI)
             self.command.wait_complete()
             self.command.mdi("G91 G1 X5 F10")
             self.command.wait_complete()
             self.command.mode(linuxcnc.MODE_MANUAL)
             self.command.wait_complete()

 

Unfortunately, it doesn't behave at all as I would imagine. Does anyone know why?
 
 
Attachments:

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

  • zz912
  • zz912's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
18 Jun 2023 18:29 - 18 Jun 2023 18:31 #273795 by zz912
I solved it.
self.command.wait_complete() has time limit.
Sorry for the spam.

On the other hand, if self.command.wait_complete() times out, a warning message could be issued.

 
Last edit: 18 Jun 2023 18:31 by zz912.

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

  • Aciera
  • Aciera's Avatar
  • Away
  • Administrator
  • Administrator
More
18 Jun 2023 18:41 #273797 by Aciera
So, how much is the default time delay and can we adjust the time delay?

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

Moderators: newbynobiHansU
Time to create page: 0.119 seconds
Powered by Kunena Forum