Esempio n. 1
0
    def __init__(self, params, imgtopic):
        # Old and new imgs
        self.old_frame = np.array([])
        self.new_frame = np.array([])

        #form str for csv file name
        self.strfile = '~/catkin_ws/' + params['detector'] + params[
            'matcher'] + str(datetime.datetime.now()) + '.csv'

        log = pd.DataFrame(columns=[
            'nfeatures', 'nmatches', 'ngoodmatches', 'reproj_error', 'ex_time'
        ])
        log.to_csv(self.strfile)
        rospy.loginfo('saving log file in %s', self.strfile)

        # Create filter image instance for video VideoCorrections
        self.videocorrect = VideoCorrect()

        # Create Visual Odometry instance
        self.vo = VisualOdometry(params)

        self.image_sub = rospy.Subscriber(imgtopic,
                                          CompressedImage,
                                          self.img_callback,
                                          queue_size=1)
        rospy.loginfo("Subscribed to %s topic", imgtopic)

        self.img_pub = rospy.Publisher('/BlueRov2/image_matches',
                                       Image,
                                       queue_size=1)