Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Segmentation fault with graphic object in Rqt plugin

I am building my own rqt plugin. I found this attitude indicator widget and I managed to include it in my rqt plugin. As creators said, it "uses a lot of CPU power", but I managed to have it working after the pression of a key

these lines of code add the widget

#manual insert attidue into attitude layout 
self.attitude_w = AttitudeIndicator()

these lines creates the callback


with this calling the widget works when pressing "A" on keyboard

#random attitude
self.shortcut_a = QShortcut(QKeySequence(Qt.Key_A), self._widget)
self.shortcut_a.activated.connect(lambda: self._ATTITUDE(self.roll,self.pitch) #lambda allow to call function with args)

after that I successfully subscribe to the joy node, I tried to use it in my plugin like

  self.myjoy = Float32MultiArray
  self.myjoy = rospy.Subscriber("joy", Joy, self.joyread, queue_size=1)
except ValueError, e:
    rospy.logerr('Error connecting topic (%s)'%e)    

    def joyread(self,data):
        self.myjoy = data
        self.sensing0 = 10*self.myjoy.axes[0]
        self.sensing1 = 10*self.myjoy.axes[1]
        self.pitch = 10*self.myjoy.axes[3]
        self.roll =  10*self.myjoy.axes[2]
        self._sensors(self.sensing0, self.sensing1) # this works continously
        self._ATTITUDE(self.roll,self.pitch) #this made the plugin crash

Joy and all the other callbacks work, but if I tried to use the attitude callback in the joy subscription, I obtain

Segmentation fault (core dump created)
  1. The problem is that the joy sends signal too fast? (The widget can not update itself so fast) I try to lighten the widget by deleting the hover thing and the white lines, but it does not change my situation
  2. How can I check, and maybe solve this?
  3. Turn the widget into an openGL widget would help me? (I never tried openGL widget, never build them)