def positionall(): t1=time.time() vision = psl.SSLVisionClient('224.5.23.2', 10020) vision.connect() tcontrol = psl.SSLgrSimClient('127.0.0.1', 20011) tcontrol.connect() L=[] while len(L)!=5: data=vision.receive() if len(data.detection.robots_yellow) != 0 : for r in data.detection.robots_yellow: if r.robot_id==0: dy0=data if 'y0' not in L: L.append('y0') else : dy1=data if 'y1' not in L: L.append('y1') elif len(data.detection.robots_blue)!=0: for r in data.detection.robots_blue: if r.robot_id==1: db1=data if 'b1' not in L: L.append('b1') else : db0=data if 'b0' not in L: L.append('b0') if len(data.detection.balls)!=0: dball=data if 'ball' not in L: L.append('ball') t2=time.time() Pos=dict() Pos[('b',0)]=db0 Pos[('b',1)]=db1 Pos[('y',0)]=dy0 Pos[('y',1)]=dy1 Pos['ball']=dball return Pos
""" import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import matplotlib.patches as patches import matplotlib.lines as lines import potentiel as pt from psl_package import paris_saclay_league as psl import cmath as c import time import numpy as np import ia_v3 as ia #Connexion au simulateur vision = psl.SSLVisionClient(ip='224.5.23.2', port=10020) vision.connect() grSim = psl.SSLgrSimClient('127.0.0.1', 20011) grSim.connect() #%% Paramètres #TERRAIN longueur = 1350 largeur = 1000 xmin = -longueur xmax = longueur ymin = -largeur ymax = largeur ##ROBOT
def __init__(self, robots, balle): self.robots = robots #Contient une liste de tous les robots presents sur le terrain self.balle = balle self.vision = psl.SSLVisionClient(ip='224.5.23.2', port=10020) self.vision.connect()