How to implement an operation loop and maintain a GUI responsive (PyQt)
HI,
My problem is to develop a cartesian robot. I already finished the communication with the robot, but when I apply a certain group of coordinates, due the time needed for complete a loop/cycle to determine if the points is reached, a GUI made by me in PyQt freezes until the robot finish the trajectory. I solved this part by adding a QThread
to the class responsible to do the movement, but other problem appears...the robot now only can perform the first coordinate and cannot publish the second and the next coordinates due a problem:
raise ROSException("publish() to a closed topic")
For me, the thread maintain publish occupied with first coordinate and don't leave the process. Even using QMutex
can't solve the problem.
I used this tutorial: http://www.aizac.info/the-easiest-way...
..to base me in use of rospy.spin()
(because the rospy.spin()
prevent the PyQt
GUI to even open)
but no success.
In resume: my robot works with coordinates passed, but freezes GUI; Using QThreads
, the freeze problem is solved, but lock the publish.
Thanks in advance and sorry for my bad english.
This is
rospy
. You don't need to runspin()
. It does nothing but sleep.If this was
roscpp
, things would be different (and you could use anAsyncSpinner
fi).I already done that. Removed the
rospy.spin()
, works ok. But the problem is not this, is the loop I need to place inside to do the operations. The robot (and proccess) need to do this:This loop is not infinite, but requires a certain time. That's why the GUI freezes. I ...(more)