ros - Advertising integer on python callback -


i'm writing plugin in python-based ros, when run package , press button in gui, advertise integer value of 1 on get_queue callback, signaling true. define callback as:

def getqueue_cb(self):

self.get_queue_pub.publish(1)

and above in code have:

self.get_queue_pub = rospy.publisher('get_queue', int(1), queue_size=10)

when run package in ros, glitches. when comment out second part of code have written here, rest of gui pops , runs fine. feel problem syntax integers. let me know i'm doing wrong if can.

you cannot directly publish integers, have use 1 of "integer messages" defined in std_msgs. try following:

from std_msgs.msg import int32 self.get_queue_pub = rospy.publisher('get_queue', int32, queue_size=10) 

(the second argument of publisher expects message type, not actual value.)