5 from strands_executive_msgs
import task_utils
6 from strands_executive_msgs.msg
import Task
7 from strands_navigation_msgs.msg
import TopologicalMap
8 from strands_navigation_msgs.srv
import EstimateTravelTime
9 from mongodb_store_msgs.msg
import StringList
10 from mongodb_store.message_store
import MessageStoreProxy
12 from datetime
import time, date, timedelta
21 return Task(start_node_id=waypoint_name, end_node_id=waypoint_name, max_duration=rospy.Duration(30))
25 """ Creates a routine which simply visits nodes. """
27 def __init__(self, daily_start, daily_end, tour_duration_estimate=None, idle_duration=rospy.Duration(5), charging_point =
'ChargingPoint'):
29 RobotRoutine.__init__(self, daily_start, daily_end, idle_duration=idle_duration, charging_point=charging_point)
32 rospy.Subscriber(
'topological_map', TopologicalMap, self.
map_callback)
36 print 'got map: %s' % len(msg.nodes)
37 self.
node_names = set([node.name
for node
in msg.nodes
if node.name !=
'ChargingPoint'])
57 expected_time = rospy.ServiceProxy(
'topological_navigation/travel_time_estimator', EstimateTravelTime)
59 max_time = rospy.Duration(0)
60 for start
in waypoints:
63 et = expected_time(start=start, target=end).travel_time
77 tour_duration_estimate = single_node_estimate * (len(waypoints)-1) * 2
78 repeat_delta = timedelta(seconds=tour_duration_estimate)
82 self.
create_task_routine(tasks=tasks, daily_start=daily_start, daily_end=daily_end, repeat_delta=repeat_delta)
94 Called when the routine is idle. Default is to trigger travel to the charging. As idleness is determined by the current schedule, if this call doesn't utlimately cause a task schedule to be generated this will be called repeatedly.
99 rospy.loginfo(
'Idle for too long, generating a random waypoint task')
def map_callback(self, msg)
def create_patrol_task(waypoint_name)
def max_single_trip_time(self, waypoints)
def create_patrol_routine