Ask Your Question

Revision history [back]

You don't want to be changing qt displays directly from ros callbacks, they are owned by different threads. I'm not sure if repaint() actually violates that thread boundary or not, assuming it does you would avoid it by something like

self.do_update_attitude = QtCore.pyqtSignal(float, float)
def update_attitude(self, roll, pitch):

and then in the joy callback:

self.do_update_attitude.emit(self.roll, self.pitch)

You could alternatively have a qt timer that only updates the attitude widget at 30 Hz or less which would limit cpu usage (look at The attitude widget api is calling repaint for setRoll and setPitch, it would be good to modify it so it repaint is called separately since roll and pitch are always getting updated at the same time and then there would be half the paint events.