<commit_before>#!/usr/bin/env python

import rospy

from strands_executive_msgs.msg import Task
from strands_executive_msgs.srv import AddTask, SetExecutionStatus
from std_msgs.msg import String
from random import shuffle


class PatrolScheduler(object):

	def __init__(self):
		self.waypoints = ['WayPoint1', 'WayPoint2', 'WayPoint3']
		self.current_waypoint = ''
		self.add_task_srv = None
		rospy.Subscriber("/current_node", String, self.current_node_cb)
		
		add_task_srv_name = '/task_executor/add_task'
		set_exe_stat_srv_name = '/task_executor/set_execution_status'
		rospy.loginfo("Waiting for task_executor service...") 
		rospy.wait_for_service(add_task_srv_name) 
		rospy.wait_for_service(set_exe_stat_srv_name) 
		rospy.loginfo("Done") 
		self.add_task_srv = rospy.ServiceProxy(add_task_srv_name, AddTask) 
		set_execution_status_srv = rospy.ServiceProxy(set_exe_stat_srv_name, SetExecutionStatus)
		
		shuffle(self.waypoints) 
		self.send_tasks() 
<commit_msg>Using proper nodes from datacentre via ros param.<commit_after>#!/usr/bin/env python

import rospy

from strands_executive_msgs.msg import Task
from strands_executive_msgs.srv import AddTask, SetExecutionStatus
from std_msgs.msg import String
from random import shuffle
from ros_datacentre.message_store import MessageStoreProxy
from topological_utils.msg import node

def load_nodes():
    msg_store = MessageStoreProxy()
    query_meta = {}
    query_meta["pointset"] = rospy.get_param('topological_map_name')
    nodes = msg_store.query(node._type, {}, query_meta)
    return [n for [n, meta] in nodes]


class PatrolScheduler(object):
	""" Repeatedly ends a randomised list of task to the task executor. These don't have tasks associated with them. If you want to add tasks, see fifo_tester.py for an example."""
	def __init__(self):

		# load waypoint from datacentre
		nodes = load_nodes()
		# and extract the names for later
		self.waypoints = [n.name for n in nodes]
		rospy.loginfo('Patrolling the following nodes: %s' % self.waypoints)
		self.current_waypoint = ''
		self.add_task_srv = None
		rospy.Subscriber("/current_node", String, self.current_node_cb)
		
		add_task_srv_name = '/task_executor/add_task'
		set_exe_stat_srv_name = '/task_executor/set_execution_status'
		rospy.loginfo("Waiting for task_executor service...") 
		rospy.wait_for_service(add_task_srv_name) 
		rospy.wait_for_service(set_exe_stat_srv_name) 
		rospy.loginfo("Done") 
		self.add_task_srv = rospy.ServiceProxy(add_task_srv_name, AddTask) 
		set_execution_status_srv = rospy.ServiceProxy(set_exe_stat_srv_name, SetExecutionStatus)
		
		shuffle(self.waypoints) 
		self.send_tasks() 

{'fraction_non_alphanumeric': 0.08963691376701967, 'fraction_numerical': 0.0011346444780635401, 'mean_word_length': 5.451219512195122, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5871625', 'n_tokens_mistral': 1009, 'n_tokens_neox': 921, 'n_words': 189}