c.wait_complete()

More
04 Dec 2019 04:33 #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
import linuxcnc
s = linuxcnc.stat()
c = linuxcnc.command()
c.wait_complete()
It is often presented after a changed of mode command such as
c.mode(linuxcnc.MODE_MDI)
c.wait_complete()
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

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

More
04 Dec 2019 07:06 #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
The following user(s) said Thank You: Nico2017

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

More
05 Dec 2019 20:57 #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
The following user(s) said Thank You: Nico2017

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

More
06 Dec 2019 10:41 - 06 Dec 2019 10:42 #152143 by cmorley
Replied by cmorley 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.

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.
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
Last edit: 06 Dec 2019 10:42 by cmorley.
The following user(s) said Thank You: Nico2017

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

More
09 Dec 2019 19:25 #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

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

Moderators: mhaberlerHansU
Time to create page: 0.080 seconds
Powered by Kunena Forum