6 from strands_executive_msgs
import task_utils
8 from topological_navigation.msg
import GotoNodeAction
9 from task_executor
import task_routine
10 from datetime
import *
11 from threading
import Thread
12 import mongodb_store_msgs.srv
as dc_srv
13 from mongodb_store_msgs.msg
import StringPair
14 import mongodb_store.util
as dc_util
15 from mongodb_store.message_store
import MessageStoreProxy
16 from geometry_msgs.msg
import Pose, Point, Quaternion
23 Create an example of a task which we'll copy for other tasks later.
24 This is a good example of creating a task with a variety of arguments.
27 msg_store = MessageStoreProxy()
30 pose_name =
"my favourite pose"
33 message, meta = msg_store.query_named(pose_name, Pose._type)
36 message = Pose(Point(0, 1, 2), Quaternion(3, 4, 5, 6))
37 pose_id = msg_store.insert_named(pose_name, message)
41 master_task = Task(action=
'test_task')
42 task_utils.add_string_argument(master_task,
'hello world')
43 task_utils.add_object_id_argument(master_task, pose_id, Pose)
44 task_utils.add_int_argument(master_task, 24)
45 task_utils.add_float_argument(master_task, 63.678)
50 if __name__ ==
'__main__':
52 rospy.init_node(
"task_routine", log_level=rospy.INFO)
55 while not rospy.is_shutdown()
and rospy.get_rostime().secs == 0:
60 start = time(8,30, tzinfo=localtz)
61 ten = time(10,00, tzinfo=localtz)
62 midday = time(12,00, tzinfo=localtz)
63 end = time(17,00, tzinfo=localtz)
64 morning = (start, midday)
65 afternoon = (midday, end)
69 routine = task_routine.DailyRoutine(start, end)
70 routine.repeat_every_hour(task, hours=2)