RQT subscriber plugin

asked 2013-10-09 22:44:36 -0600

lui gravatar image

updated 2014-01-28 17:18:11 -0600

ngrennan gravatar image

Hi everyone, I am working on a rqt plugin which subscribes data from my quadcopter and display the values on a UI. However get the following error: TypeError: pyqtSignal must be bound to a QObject, not 'FlightPanel' when I close the plugin.

class FlightPanel(Plugin):

updateDisplay = QtCore.pyqtSignal( )
def __init__(self, context):
    super(FlightPanel, self).__init__(context)
    # Give QObjects reasonable names
    self.setObjectName('FlightPanel')


    def callback(data):
        self.state = data.state
        self.rollAngle = data.rollAngle
        self.pitchAngle = data.pitchAngle
        self.ultrasonicAltitude = data.ultrasonicAltitude
        self.depthAltitude = data.depthAltitude
        self.velocityX = data.velocityX
        self.velocityY = data.velocityY
        self.autoThrottle = data.autoThrottle
        self.autoRoll = data.autoRoll
        self.autoPitch = data.autoPitch
        self.autoYaw = data.autoYaw
        self.updateDisplay.emit( )
        #print self.state

    rospy.Subscriber("flightFeedback", flightFeedback, callback)

    self.updateDisplay.connect( self.update_display )

@QtCore.pyqtSlot()
def update_display( self ):
    self._widget.line_edit_roll_angle.setText(str(self.rollAngle))
    self._widget.line_edit_pitch_angle.setText(str(self.pitchAngle))
    self._widget.line_edit_ultrasonic_altitude.setText(str(round (self.ultrasonicAltitude, 2)))
    self._widget.line_edit_depth_altitude.setText(str(self.depthAltitude))
    self._widget.line_edit_velocity_x.setText(str(round (self.velocityX, 2)))
    self._widget.line_edit_velocity_y.setText(str(round (self.velocityY, 2)))
    self._widget.line_edit_auto_throttle.setText(str(self.autoThrottle))
    self._widget.line_edit_auto_roll.setText(str(self.autoRoll))
    self._widget.line_edit_auto_pitch.setText(str(self.autoPitch))
    self._widget.line_edit_auto_yaw.setText(str(self.autoYaw))
edit retag flag offensive close merge delete