#!/usr/bin/env python import roslib roslib.load_manifest('faa_data_save') import rospy import threading import os from faa_data_save.msg import SaveData from faa_image_processing.msg import TrackingData from faa_utilities import FileTools from faa_status.msg import Status file_tools = FileTools() class TrackingSaver(object): def __init__(self): self.lock = threading.Lock() self.saving = False self.save_sub = rospy.Subscriber('/faa_data_save/save_data', SaveData, self.save_data_callback) self.tracking_data_sub = rospy.Subscriber("/camera/tracking_data",TrackingData,self.tracking_data_callback) self.status_sub = rospy.Subscriber("/faa_status/status", Status, self.status_callback) self.tracking_data_fid = None self.tracking_data_line = '{time_secs},{time_nsecs},{status},{tunnel},{enabled},{gate0},{gate1},{gate2},{fly_x},{fly_y},{fly_angle},{chamber},{blob_x},{blob_y},{blob_area},{blob_slope},{blob_ecc}\n' self.status = "" def save_data_callback(self,data):
import rospy import rosbag import cv2 import cv import numpy from sensor_msgs.msg import Image from cv_bridge import CvBridge, CvBridgeError import argparse import os import subprocess from faa_utilities import FindData from faa_utilities import FileTools FILE_TOOLS = FileTools() DISPLAY_IMAGES = True class FigureDataProcessor(object): def __init__(self,overwrite=False): self.bridge = CvBridge() self.overwrite = overwrite self.data_image_topic = "/camera/data_image" self.fd = FindData(overwrite=overwrite) self.figure = None self.background = None if DISPLAY_IMAGES: cv2.namedWindow("Image FG") cv2.namedWindow("Image Thresh") cv2.namedWindow("Image Morphed")