- Posts: 153
- Thank you received: 0
c.wait_complete()
6 years 10 months ago #151948
by Nico2017
c.wait_complete() was created by Nico2017
Hi all,
I have been working on a machine and its GUI under the GladeVCP.
Among some command buttons, I have some jogging functions. When reading the linuxcnc.org/docs/devel/html/config/python-interface.html it is shown a command
It is often presented after a changed of mode command such as
I was just wondering what the c.wait_complete() exactly does. It seems to be waiting for the previous command instruction to be finished, but in my interface I got the feeling that it is actually freezing the interface during the time of c.wait_complete() .
Is it a command which is mandatory or can I avoid using it, especially if I take care about the timing between the commands in a different way which does not freeze my interface. Thank you,
Nicolas
I have been working on a machine and its GUI under the GladeVCP.
Among some command buttons, I have some jogging functions. When reading the linuxcnc.org/docs/devel/html/config/python-interface.html it is shown a command
Code:
import linuxcnc
s = linuxcnc.stat()
c = linuxcnc.command()
c.wait_complete()
Code:
c.mode(linuxcnc.MODE_MDI)
c.wait_complete()
Is it a command which is mandatory or can I avoid using it, especially if I take care about the timing between the commands in a different way which does not freeze my interface. Thank you,
Nicolas
Please Log in to join the conversation.
6 years 10 months ago #151953
by cmorley
Replied by cmorley on topic c.wait_complete()
It waits till the command completes or a timeout completes.
Yes it blocks python.
It's necessary if what you are asking for is necessary to be completed before the next command.
Obviously linuxcnc must be in MDI mode before you send it a MDI command.
If switching modes takes a really long time then there is something wrong.
Waiting for a MDI command to complete could of course take a long time.
In Qtvcp, for a probing routine Jim Persei and I had to work very hard to get it to work while not blocking and catching errors properly.
We actually launch a separate python program and send commands to it, so the main program doesn't block. It's a huge pain.
Chris
Yes it blocks python.
It's necessary if what you are asking for is necessary to be completed before the next command.
Obviously linuxcnc must be in MDI mode before you send it a MDI command.
If switching modes takes a really long time then there is something wrong.
Waiting for a MDI command to complete could of course take a long time.
In Qtvcp, for a probing routine Jim Persei and I had to work very hard to get it to work while not blocking and catching errors properly.
We actually launch a separate python program and send commands to it, so the main program doesn't block. It's a huge pain.
Chris
Please Log in to join the conversation.
6 years 10 months ago #152109
by newbynobi
Replied by newbynobi on topic c.wait_complete()
According to my experience it does not wait to a command to be completed on every situation. I. E. Change To MDI, execute a command, change back to manual and wait to the complete command, signal.
Dont be surprised if you never get that signal till you do a movement,!
You will need to find work arrounds in certain circumstances. You may look in the gmoccapy code for solutions.
Norbert
Dont be surprised if you never get that signal till you do a movement,!
You will need to find work arrounds in certain circumstances. You may look in the gmoccapy code for solutions.
Norbert
Please Log in to join the conversation.
6 years 10 months ago #152143
by cmorley
There is a default timeout - so if your command runs past 5 seconds, the wait will return before the command finishes.
I have not see then behavior you describe in 2.8+ at least - do you have a sample that reproduces it?
Chris
Replied by cmorley on topic c.wait_complete()
If you are referring to issuing 3 commands and waiting for the last one to complete then I'm not surprised it doesn't work as you wish.newbynobi wrote: According to my experience it does not wait to a command to be completed on every situation. I. E. Change To MDI, execute a command, change back to manual and wait to the complete command, signal.
There is a default timeout - so if your command runs past 5 seconds, the wait will return before the command finishes.
I have not see then behavior you describe in 2.8+ at least - do you have a sample that reproduces it?
Chris
Please Log in to join the conversation.
6 years 10 months ago #152388
by Nico2017
Replied by Nico2017 on topic c.wait_complete()
Hi all,
thanks for your answers. I will try to identify more precisely in which case it is freezing. Will create a minimal working example showing the case.
Thanks,
Nicolas
thanks for your answers. I will try to identify more precisely in which case it is freezing. Will create a minimal working example showing the case.
Thanks,
Nicolas
Please Log in to join the conversation.
Time to create page: 0.183 seconds
