Example #1
0
    def __init__(self):

        self.bidder = ExplorationBidder()
        self.grids_schedule = ExplorationSchedule()
        self.objects_schedule = ExplorationSchedule()
        self.bidder_timer = rospy.get_param("~bidder_timer", 3600)
        self.rescheduleInterval = rospy.get_param('~rescheduleInterval', 86400)
        self.slot_duration = 0
        self.num_slots = 0
        self.last_bid = 0

        #every 5 min check current time slot
        rospy.Timer(rospy.Duration(60 * 5), self.add_task)
        rospy.Subscriber("/exploration_schedule", ExplorationSchedule,
                         self.schedule_grids_listener)
        rospy.Subscriber("/object_schedule", ExplorationSchedule,
                         self.schedule_objects_listener)
Example #2
0
 def __init__(self,
              start_time=(8, 0),
              end_time=(18, 0),
              observe_interval=rospy.Duration(1800)):
     rospy.loginfo("Initiating budgetting control...")
     # hand-allocated budget (between 8am to 6pm)
     self.observe_interval = observe_interval
     self._start_time = datetime.time(start_time[0], start_time[1])
     self._end_time = datetime.time(end_time[0], end_time[1])
     self.budget_alloc = list()
     self.available_budget = 0
     tmp = datetime.datetime.fromtimestamp(rospy.Time.now().secs)
     self._update_budget_date = datetime.datetime(tmp.year, tmp.month,
                                                  tmp.day, 0, 0)
     self.bidder = ExplorationBidder()
     self.soma_config = rospy.get_param("~soma_config",
                                        "activity_exploration")
     self._db = MessageStoreProxy(collection="activity_exploration_log")
     # all services to counters
     people_srv_name = rospy.get_param(
         "~people_srv", "/people_counter/people_best_time_estimate")
     if people_srv_name != "":
         rospy.loginfo("Connecting to %s service..." % people_srv_name)
         self._people_srv = rospy.ServiceProxy(people_srv_name,
                                               PeopleBestTimeEstimateSrv)
         self._people_srv.wait_for_service()
     act_srv_name = rospy.get_param(
         "~activity_srv", "/activity_counter/activity_best_time_estimate")
     if act_srv_name != "":
         rospy.loginfo("Connecting to %s service..." % act_srv_name)
         self._act_srv = rospy.ServiceProxy(act_srv_name,
                                            ActivityBestTimeEstimateSrv)
         self._act_srv.wait_for_service()
     scene_srv_name = rospy.get_param(
         "~scene_srv", "/scene_counter/scene_best_time_estimate")
     if scene_srv_name != "":
         rospy.loginfo("Connecting to %s service..." % scene_srv_name)
         self._scene_srv = rospy.ServiceProxy(scene_srv_name,
                                              SceneBestTimeEstimateSrv)
         self._scene_srv.wait_for_service()
Example #3
0
    def __init__(self):
        self.bidder = ExplorationBidder()
        self.map_received = False
        rospy.on_shutdown(self.shutdown)

        self.service_timeout = rospy.get_param("~timeout", 10)
        self.time_of_slots = rospy.get_param("~slot_time", 1200)
        host = rospy.get_param("mongodb_host")
        port = rospy.get_param("mongodb_port")
        self.mongo_client = pymongo.MongoClient(host, port)

        rospy.Subscriber('/topological_map', TopologicalMap, self.MapCallback)
        rospy.loginfo("Waiting for Topological map ...")
        while not self.map_received:
            rospy.sleep(rospy.Duration(0.1))
        rospy.loginfo("... Got Topological map")

        self.get_info()
        self.timer_obj = rospy.Timer(rospy.Duration(self.time_of_slots),
                                     self.get_exploration_task_cb)
        self.timer_obj2 = rospy.Timer(rospy.Duration(30), self.get_info_cb)
        self.get_exploration_task()
        rospy.spin()
    def __init__(self):

        self.bidder = ExplorationBidder()

        rospy.Timer(rospy.Duration(60), self.add_task)