def __init__(self):
self.bridge = CvBridge()
# initializes subscriber for Baxter's left hand camera image topic
self.image_sub = rospy.Subscriber("/cameras/left_hand_camera/image",Image,self.find_cups)
# initializes subscriber for the location of the treasure (published by the find_treasure node)
self.treasure_location_sub = rospy.Subscriber("/treasure_location",Treasure,self.find_treasure)
# initializes publisher to publish the location of the cup containing the treasure
self.treasure_cup_pub = rospy.Publisher("treasure_cup_location",Point,queue_size=10)
# initializes publisher to publish the processed image to Baxter's display
self.image_tracking_pub = rospy.Publisher("/robot/xdisplay",Image,queue_size=10)
self.treasure_cup_location = Point()
self.cups = []
self.cupCenters = [[0,0],[0,0],[0,0]]
self.wasPreviouslyTrue = False
self.flag = False
self.minRadius = 10
for i in range(0,3):
self.cups.append(cup())
# determines the location of the 3 red cups (callback for the image topic subscriber)
评论列表
文章目录