Exemplo n.º 1
0
    def __init__(self, image_topic):
        """ Initialize the sign tracker """
        rospy.init_node('sign_tracker')
        self.cv_image = None                        # the latest image from the camera
        self.bridge = CvBridge()                    # used to convert ROS messages to OpenCV

        # matcher needs to be created but since the cropped image is not yet available initialize the matcher with None
        self.matcher = SignMatcher(None)

        self.maxContour = 0
        self.maxCArea = 0
        self.cropped = 0

        # counter to properly perform the turns for the correct period of time
        self.counter = 0
        self.counterMax = 63

        self.receivedCommand = False

        self.signArea = 4500

        self.twist = Twist()
        self.twist.linear.x = .1

        rospy.Subscriber(image_topic, Image, self.process_image)
        self.pub = rospy.Publisher('cmd_vel', Twist, queue_size=10)
        cv2.namedWindow('video_window')
        cv2.namedWindow('threshold_image')