def _get_pantilt(self, point_name, point_set):
        mongo = pymongo.MongoClient(rospy.get_param("datacentre_host"),
                                    rospy.get_param("datacentre_port"))
	pt = PanTilt()
	pt.pan_increment = -1
	pt.tilt_increment = -1
	# first check whether PT is defined for this waypoint	
	pt_name = point_name+"_pan_tilt"
	
	try:
	   index = self.pantilts.index([point_set,pt_name])
           search = {"meta.name": pt_name,
                     "meta.pantiltset": point_set}
           p = mongo.autonomous_patrolling.waypoints.find(search)            
           p = p[0]
           meta, pt = strands_datacentre.util.document_to_msg(p, PanTilt)
	except ValueError:
	   # No pan tilt defined for this waypoint	
	   print "Pan tilt not defined for ", point_name
        return pt
def way_points_file_to_datacentre(filename, dataset_name, map_name):
    host = rospy.get_param("datacentre_host")
    port = rospy.get_param("datacentre_port")
    print "Using datacentre  ",host,":", port
    client = pymongo.MongoClient(host, port)
    db=client.autonomous_patrolling
    points_db=db["waypoints"]
    
    points=[]
    with open(filename, 'rb') as csvfile:
        reader = csv.reader(csvfile, delimiter=',')
        for row in reader:
            current_row=[]
            for element in row:
                current_row.append(float(element))
            points.append(current_row)

    for i,point in enumerate(points):
        entry={}
        entry["map"]=map_name
        if i==0:
            entry["name"]="charging_point"
        else:
            entry["name"]="Point%d"%i
        entry["pointset"]=dataset_name

        p = Pose()
        p.position.x=point[0]
        p.position.y=point[1]
        p.position.z=point[2]
        p.orientation.x=point[3]
        p.orientation.y=point[4]
        p.orientation.z=point[5]
        p.orientation.w=point[6]
        strands_datacentre.util.store_message(points_db,p,entry)

	if (len(point) > 12):
		entry={}
		entry["name"]="Point%d_pan_tilt"%i
		entry["map"]=map_name
        	entry["pantiltset"]=dataset_name
		pt = PanTilt()
		pt.pan_start = point[7]	
		pt.pan_increment = point[8]	
		pt.pan_end = point[9]	
		pt.tilt_start = point[10]	
		pt.tilt_increment = point[11]	
		pt.tilt_end = point[12]	
        	
		strands_datacentre.util.store_message(points_db,pt,entry)