def __init__(self, name, soma_map, soma_config, minute_interval, window_interval, collection="occurrence_rates"): self.topo_map = None self.soma_map = soma_map self.soma_config = soma_config self.minute_interval = minute_interval self.window_interval = window_interval self.rotm = RegionObservationTimeManager(soma_map, soma_config) self.tre = TrajectoryRegionEstimate(soma_map, soma_config, minute_interval) self.tof = TrajectoryOccurrenceFrequencies( soma_map, soma_config, minute_interval=minute_interval, window_interval=window_interval) self.gs = GeoSpatialStoreProxy('geospatial_store', 'soma') rospy.loginfo("Connect to database collection %s..." % collection) self._ms = MessageStoreProxy(collection=collection) self._soma_db = MessageStoreProxy(collection="soma_roi") rospy.loginfo("Create a service %s/service..." % name) self.service = rospy.Service(name + '/service', TrajectoryOccurrenceRate, self.srv_cb) rospy.loginfo("Create an action server %s..." % name) self._as = actionlib.SimpleActionServer(name, OccurrenceRateLearningAction, execute_cb=self.execute, auto_start=False) self._as.start()
rospy.logerr( "usage: tof soma config start_date end_date month year minute_interval window_time" ) sys.exit(2) # the interval minute must be the same for Trajectory Region Knowledge and # Continuous TOF interval = int(sys.argv[7]) window = int(sys.argv[8]) start_date = int(sys.argv[3]) end_date = int(sys.argv[4]) month = int(sys.argv[5]) year = int(sys.argv[6]) temp_start_time = rospy.Time.now() tre = TrajectoryRegionEstimate(sys.argv[1], sys.argv[2], interval) if start_date > 1: trajectory_estimate = tre.estimate_trajectories_daily( # range(1, calendar.monthrange(year, month)[1]+1), month, year range(start_date - 1, end_date + 1), month, year) else: trajectory_estimate = tre.estimate_trajectories_daily( # range(1, calendar.monthrange(year, month)[1]+1), month, year range(start_date, end_date + 1), month, year) tof = TrajectoryOccurrenceFrequencies(sys.argv[1], sys.argv[2],