def monitor(self):
# Wait until subscriber on instruct message is present
notified = False
while not rospy.is_shutdown():
_, subscribers, _ = Master('/needybot').getSystemState()
if dict(subscribers).get(nb_channels.Messages.instruct.value) is not None:
if self.is_connected == False:
self.connected_pub.publish()
self.is_connected = True
else:
if self.is_connected or not notified:
notified = True
self.disconnected_pub.publish()
self.is_connected = False
rospy.sleep(0.1)
评论列表
文章目录