Esempio n. 1
0
	def __init__(self,engine,posinit, orientation):
		if (orientation == "vert"): # |
			points_feu = map(lambda p: mm_to_px(*p),[(0,0),(30,0),(30,140),(0,140)])
			points_triangle = map(lambda p: mm_to_px(*p),[(0,0),(70,55),(0,140)])
			offset_triangle = mm_to_px(15,-70)
		else: # ---
			points_feu = map(lambda p: mm_to_px(*p),[(0,0),(140,0),(140,30),(0,30)])
			points_triangle = map(lambda p: mm_to_px(*p),[(0,0),(55,70),(140,0)])
			offset_triangle = mm_to_px(-70,15)
		EngineObjectPoly.__init__(self,
			engine			= engine,
			colltype		= COLLTYPE_FEU,
			posinit			= posinit,
			mass			= 80,
			poly_points		= points_feu
		)

		self.triangle = EngineObjectPoly(
			engine 		= engine,
			colltype	= COLLTYPE_FEU,
			offset		= offset_triangle,
			color		= "purple",
			poly_points = points_triangle,
			is_extension= True
		)
		self.__is_down = False
		self.coucher_feu()
Esempio n. 2
0
	def __init__(self, *, engine, team, posinit, mass, poly_points,
				 typerobot, extension_objects=[], colltype):
		color = 'yellow' if team == YELLOW else 'red'
		EngineObjectPoly.__init__(self,
			engine		 	= engine,
			mass			= mass,
			posinit			= posinit,
			color			= color,
			colltype		= colltype, 
			poly_points		= poly_points,
			extension_objects	= extension_objects
		)

	#données d'état du robot
		self.__typerobot = typerobot
		self.__team = team
		self.__goals = []
		self.__asserv = Asserv(self)
		self.__others = Others(self)

	#données du robot utiles au simulateur
		self.__mod_teleport = False # quand on clique ça téléporte au lieu d'envoyer un ordre à l'asservissement
		self.__mod_recul = False # marche arrière ou marche avant ?
		self.__max_speed = 1000 # vitesse maximale (quand pwm=255)
		self.__stop = False

		#utilité ?
		self.__current_team = RED
		self.__current_robot = BIG

		self.body._set_velocity_func(self._my_velocity_func())
Esempio n. 3
0
	def __init__(self,engine,posinit,color):
		EngineObjectPoly.__init__(self,
			engine			= engine,
			colltype		= COLLTYPE_CADEAU,
			posinit			= posinit,
			mass			= MASS_INF,
			color			= color,
			poly_points		= map(lambda p: mm_to_px(*p),[(0,0),(150,0),(150,22),(0,22)])
		)
Esempio n. 4
0
	def __init__(self,engine,posinit):
		EngineObjectPoly.__init__(self,
			engine			= engine,
			colltype		= COLLTYPE_CERISE,
			posinit			= posinit,
			color			= "purple",
			mass			= 380,
			poly_points		= map(lambda p: mm_to_px(*p),[(0,0),(170,0),(170,170),(0,170)])
		)
Esempio n. 5
0
	def __init__(self,engine,posinit,color):
		EngineObjectPoly.__init__(self,
			engine			= engine,
			colltype		= COLLTYPE_BAC,
			posinit			= posinit,
			mass			= MASS_INF,
			color			= color,
			poly_points		= map(lambda p: mm_to_px(*p),[(0,0),(700,0),(700,300-25),(0,300-25)])
		)
		self.nbFruit = 0
Esempio n. 6
0
	def __init__(self,engine,posinit):
		EngineObjectPoly.__init__(self,
			engine			= engine,
			colltype		= COLLTYPE_FRESQUE,
			posinit			= posinit,
			color			= "white",
			mass			= MASS_INF,
			poly_points		= map(lambda p: mm_to_px(*p),[(0,0),(600,0),(600,22),(0,22)])
		)
		self.objetsNous = 0
		self.objetsEnnemy = 0
Esempio n. 7
0
	def __init__(self,engine,posinit):
		EngineObjectPoly.__init__(self,
			engine			= engine,
			colltype		= COLLTYPE_MAMMOUTH,
			posinit			= posinit,
			color			= "brown",
			mass			= MASS_INF,
			poly_points		= map(lambda p: mm_to_px(*p),[(0,0),(700,0),(700,25),(0,25)])
		)
		self.lance = 0
		self.filet = 0
Esempio n. 8
0
 def __init__(self, engine, posinit, color):
     EngineObjectPoly.__init__(self,
                               engine=engine,
                               colltype=COLLTYPE_BAC,
                               posinit=posinit,
                               mass=MASS_INF,
                               color=color,
                               poly_points=map(lambda p: mm_to_px(*p),
                                               [(0, 0), (700, 0),
                                                (700, 300 - 25),
                                                (0, 300 - 25)]))
     self.nbFruit = 0
Esempio n. 9
0
 def __init__(self, engine, posinit):
     EngineObjectPoly.__init__(self,
                               engine=engine,
                               colltype=COLLTYPE_FRESQUE,
                               posinit=posinit,
                               color="white",
                               mass=MASS_INF,
                               poly_points=map(lambda p: mm_to_px(*p),
                                               [(0, 0), (600, 0), (600, 22),
                                                (0, 22)]))
     self.objetsNous = 0
     self.objetsEnnemy = 0
Esempio n. 10
0
 def __init__(self, engine, posinit):
     EngineObjectPoly.__init__(self,
                               engine=engine,
                               colltype=COLLTYPE_MAMMOUTH,
                               posinit=posinit,
                               color="brown",
                               mass=MASS_INF,
                               poly_points=map(lambda p: mm_to_px(*p),
                                               [(0, 0), (700, 0), (700, 25),
                                                (0, 25)]))
     self.lance = 0
     self.filet = 0
Esempio n. 11
0
	def __init__(self,engine,posinit, orientation):
		if (orientation == "droite"):
			points = map(lambda p: mm_to_px(*p),[(0,0),(75,20),(130,75),(150,150),(130,225),(75,280),(0,300)])
		elif(orientation == "gauche"):
			points = map(lambda p: mm_to_px(*p),[(0,300),(-75,280),(-130,225),(-150,150),(-130,75),(-75,20),(0,0)])
		else:
			points = map(lambda p: mm_to_px(*p),[(0,0),(20,-75),(75,-130),(150,-150),(225,-130),(280,-75),(300,0)])
		EngineObjectPoly.__init__(self,
			engine			= engine,
			colltype		= COLLTYPE_ARBRE,
			posinit			= posinit,
			color			= "green",
			mass 			= MASS_INF,
			poly_points		= points
		)
Esempio n. 12
0
	def __init__(self,engine,posinit,position):
		if (position == "droite"):
			points = map(lambda p: mm_to_px(*p),[(0,0),(-250,-0),(-241,-65),(-217,-125),(-177,-177),(-125,-217),(-65,-241),(-0,-250)])
		elif(position == "gauche"):
			points = map(lambda p: mm_to_px(*p),[(0,0),(250,0),(241,-65),(217,-125),(177,-177),(125,-217),(65,-241),(0,-250)])
		EngineObjectPoly.__init__(self,
			engine			= engine,
			colltype		= COLLTYPE_FOYER,
			posinit			= posinit,
			color			= "brown",
			mass 			= MASS_INF,
			poly_points		= points,
			layers			= 1
		)
		self.__nbFeu = 0
Esempio n. 13
0
    def __init__(self,
                 *,
                 engine,
                 team,
                 posinit,
                 mass,
                 poly_points,
                 typerobot,
                 extension_objects=[],
                 colltype):
        color = 'yellow' if team == YELLOW else 'red'
        EngineObjectPoly.__init__(self,
                                  engine=engine,
                                  mass=mass,
                                  posinit=posinit,
                                  color=color,
                                  colltype=colltype,
                                  poly_points=poly_points,
                                  extension_objects=extension_objects)

        #données d'état du robot
        self.__typerobot = typerobot  #BIG ou MINI
        self.__team = team  #RED ou YELLOW
        self.__goals = []
        self.__asserv = Asserv(self)
        self._visio = Visio(self)
        self.__others = Others(self)
        self.__stack_orders = []  #pile d'ordres historique

        #données du robot utiles au simulateur
        self.__mod_teleport = False  # quand on clique ça téléporte au lieu d'envoyer un ordre à l'asservissement
        self.__mod_recul = False  # marche arrière ou marche avant ?
        self.__max_speed = 1000  # vitesse maximale (quand pwm=255)
        self.__stop = False

        #décompte du temps pour avoir le timestamp
        self.__get_milli = lambda: int(round(time.time() * 1000))
        self.__time_stamp = self.__get_milli()
        self.__time_stamp_origine = self.__get_milli()
        self.__state_jack = 1  # jack in
        self.__asserv_blocked = 0  #passage à 1 si l'asserv est bloqué

        #!!! ne pas modifier ces variables, elles sont utilisés pour l'interaction avec l'utilisateur !
        self.__current_team = RED
        self.__current_robot = BIG

        self.body._set_velocity_func(
            self._my_velocity_func())  #voir plus bas pour le détail
Esempio n. 14
0
 def __init__(self, engine, posinit, position):
     if (position == "droite"):
         points = map(lambda p: mm_to_px(*p), [(0, 0), (-250, -0),
                                               (-241, -65), (-217, -125),
                                               (-177, -177), (-125, -217),
                                               (-65, -241), (-0, -250)])
     elif (position == "gauche"):
         points = map(lambda p: mm_to_px(*p), [(0, 0), (250, 0), (241, -65),
                                               (217, -125), (177, -177),
                                               (125, -217), (65, -241),
                                               (0, -250)])
     EngineObjectPoly.__init__(self,
                               engine=engine,
                               colltype=COLLTYPE_FOYER,
                               posinit=posinit,
                               color="brown",
                               mass=MASS_INF,
                               poly_points=points,
                               layers=1)
     self.__nbFeu = 0
Esempio n. 15
0
	def __init__(self, *, engine, team, posinit, mass, poly_points,
				 typerobot, extension_objects=[], colltype):
		color = 'yellow' if team == YELLOW else 'red'
		EngineObjectPoly.__init__(self,
			engine		 	= engine,
			mass			= mass,
			posinit			= posinit,
			color			= color,
			colltype		= colltype, 
			poly_points		= poly_points,
			extension_objects	= extension_objects
		)

	#données d'état du robot
		self.__typerobot = typerobot #BIG ou MINI
		self.__team = team #RED ou YELLOW
		self.__goals = []
		self.__asserv = Asserv(self)
		self._visio = Visio(self)
		self.__others = Others(self)
		self.__stack_orders = [] #pile d'ordres historique

	#données du robot utiles au simulateur
		self.__mod_teleport = False # quand on clique ça téléporte au lieu d'envoyer un ordre à l'asservissement
		self.__mod_recul = False # marche arrière ou marche avant ?
		self.__max_speed = 1000 # vitesse maximale (quand pwm=255)
		self.__stop = False

		#décompte du temps pour avoir le timestamp
		self.__get_milli = lambda: int(round(time.time() * 1000))
		self.__time_stamp = self.__get_milli()
		self.__time_stamp_origine = self.__get_milli()
		self.__state_jack = 1  # jack in
		self.__asserv_blocked = 0  #passage à 1 si l'asserv est bloqué

		#!!! ne pas modifier ces variables, elles sont utilisés pour l'interaction avec l'utilisateur !
		self.__current_team = RED
		self.__current_robot = BIG

		self.body._set_velocity_func(self._my_velocity_func()) #voir plus bas pour le détail
Esempio n. 16
0
 def __init__(self, engine, posinit, orientation):
     if (orientation == "droite"):
         points = map(lambda p: mm_to_px(*p), [(0, 0), (75, 20), (130, 75),
                                               (150, 150), (130, 225),
                                               (75, 280), (0, 300)])
     elif (orientation == "gauche"):
         points = map(lambda p: mm_to_px(*p), [(0, 300), (-75, 280),
                                               (-130, 225), (-150, 150),
                                               (-130, 75), (-75, 20),
                                               (0, 0)])
     else:
         points = map(lambda p: mm_to_px(*p), [(0, 0), (20, -75),
                                               (75, -130), (150, -150),
                                               (225, -130), (280, -75),
                                               (300, 0)])
     EngineObjectPoly.__init__(self,
                               engine=engine,
                               colltype=COLLTYPE_ARBRE,
                               posinit=posinit,
                               color="green",
                               mass=MASS_INF,
                               poly_points=points)
Esempio n. 17
0
	def __init__(self,engine,posinit, orientation, sens, coucher = False):
		if (orientation == "vert"): # |
			points_feu = map(lambda p: mm_to_px(*p),[(0,0),(30,0),(30,140),(0,140)])
			points_triangle_rd = map(lambda p: mm_to_px(*p),[(0,0),(70,55),(0,140)])
			offset_triangle_rd = mm_to_px(15,-70)
			points_triangle_yg = map(lambda p: mm_to_px(*p),[(0,0),(70,55),(0,140)])
			offset_triangle_yg = mm_to_px(15,-70)
			points_triangle_rg = map(lambda p: mm_to_px(*p),[(0,0),(-70,55),(0,140)])
			offset_triangle_rg = mm_to_px(-15,-70)
			points_triangle_yd = map(lambda p: mm_to_px(*p),[(0,0),(-70,55),(0,140)])
			offset_triangle_yd = mm_to_px(-15,-70)
		else: # ---
			points_feu = map(lambda p: mm_to_px(*p),[(0,0),(140,0),(140,30),(0,30)])
			points_triangle_rd = map(lambda p: mm_to_px(*p),[(0,0),(55,70),(140,0)])
			offset_triangle_rd = mm_to_px(-70,15)
			points_triangle_yg = map(lambda p: mm_to_px(*p),[(0,0),(55,70),(140,0)])
			offset_triangle_yg = mm_to_px(-70,15)
			points_triangle_rg = map(lambda p: mm_to_px(*p),[(0,0),(55,-70),(140,0)])
			offset_triangle_rg = mm_to_px(-70,-15)
			points_triangle_yd = map(lambda p: mm_to_px(*p),[(0,0),(55,-70),(140,0)])
			offset_triangle_yd = mm_to_px(-70,-15)

		EngineObjectPoly.__init__(self,
			engine			= engine,
			colltype		= COLLTYPE_FEU,
			posinit			= posinit,
			mass			= 80,
			poly_points		= points_feu,
			layers			= 2
		)

#on a 4 extensions car 2 couleurs qui peuvent être des 2 côtés du triangle.

		self.triangleRedDroite = EngineObjectPoly(
			engine 		= engine,
			colltype	= COLLTYPE_FEU,
			offset		= offset_triangle_rd,
			color		= "red",
			poly_points = points_triangle_rd,
			layers			= 2,
			is_extension= True
		)

		self.triangleYellowGauche = EngineObjectPoly(
			engine 		= engine,
			colltype	= COLLTYPE_FEU,
			offset		= offset_triangle_yd,
			color		= "yellow",
			poly_points = points_triangle_yd,
			layers			= 2,
			is_extension= True
		)

		self.triangleRedGauche= EngineObjectPoly(
			engine 		= engine,
			colltype	= COLLTYPE_FEU,
			offset		= offset_triangle_rg,
			color		= "red",
			poly_points = points_triangle_rg,
			layers			= 2,
			is_extension= True
		)

		self.triangleYellowDroite = EngineObjectPoly(
			engine 		= engine,
			colltype	= COLLTYPE_FEU,
			offset		= offset_triangle_yg,
			color		= "yellow",
			poly_points = points_triangle_yg,
			layers			= 2,
			is_extension= True
		)

		self.orientation = orientation
		if (sens == 'r'):
			self.__coucher_a_gauche = 'y'
			self.__coucher_a_droite = 'r'
		else:
			self.__coucher_a_gauche = 'r'
			self.__coucher_a_droite = 'y'
		self.__is_down = False
		self.__extension_down = None #variable qui stock l'extension utilisée pour coucher le feu
		self.__eteindre_flag = False
Esempio n. 18
0
    def __init__(self, engine, posinit, orientation, sens, coucher=False):
        if (orientation == "vert"):  # |
            points_feu = map(lambda p: mm_to_px(*p), [(0, 0), (30, 0),
                                                      (30, 140), (0, 140)])
            points_triangle_rd = map(lambda p: mm_to_px(*p), [(0, 0), (70, 55),
                                                              (0, 140)])
            offset_triangle_rd = mm_to_px(15, -70)
            points_triangle_yg = map(lambda p: mm_to_px(*p), [(0, 0), (70, 55),
                                                              (0, 140)])
            offset_triangle_yg = mm_to_px(15, -70)
            points_triangle_rg = map(lambda p: mm_to_px(*p), [(0, 0),
                                                              (-70, 55),
                                                              (0, 140)])
            offset_triangle_rg = mm_to_px(-15, -70)
            points_triangle_yd = map(lambda p: mm_to_px(*p), [(0, 0),
                                                              (-70, 55),
                                                              (0, 140)])
            offset_triangle_yd = mm_to_px(-15, -70)
        else:  # ---
            points_feu = map(lambda p: mm_to_px(*p), [(0, 0), (140, 0),
                                                      (140, 30), (0, 30)])
            points_triangle_rd = map(lambda p: mm_to_px(*p), [(0, 0), (55, 70),
                                                              (140, 0)])
            offset_triangle_rd = mm_to_px(-70, 15)
            points_triangle_yg = map(lambda p: mm_to_px(*p), [(0, 0), (55, 70),
                                                              (140, 0)])
            offset_triangle_yg = mm_to_px(-70, 15)
            points_triangle_rg = map(lambda p: mm_to_px(*p), [(0, 0),
                                                              (55, -70),
                                                              (140, 0)])
            offset_triangle_rg = mm_to_px(-70, -15)
            points_triangle_yd = map(lambda p: mm_to_px(*p), [(0, 0),
                                                              (55, -70),
                                                              (140, 0)])
            offset_triangle_yd = mm_to_px(-70, -15)

        EngineObjectPoly.__init__(self,
                                  engine=engine,
                                  colltype=COLLTYPE_FEU,
                                  posinit=posinit,
                                  mass=80,
                                  poly_points=points_feu,
                                  layers=2)

        #on a 4 extensions car 2 couleurs qui peuvent être des 2 côtés du triangle.

        self.triangleRedDroite = EngineObjectPoly(
            engine=engine,
            colltype=COLLTYPE_FEU,
            offset=offset_triangle_rd,
            color="red",
            poly_points=points_triangle_rd,
            layers=2,
            is_extension=True)

        self.triangleYellowGauche = EngineObjectPoly(
            engine=engine,
            colltype=COLLTYPE_FEU,
            offset=offset_triangle_yd,
            color="yellow",
            poly_points=points_triangle_yd,
            layers=2,
            is_extension=True)

        self.triangleRedGauche = EngineObjectPoly(
            engine=engine,
            colltype=COLLTYPE_FEU,
            offset=offset_triangle_rg,
            color="red",
            poly_points=points_triangle_rg,
            layers=2,
            is_extension=True)

        self.triangleYellowDroite = EngineObjectPoly(
            engine=engine,
            colltype=COLLTYPE_FEU,
            offset=offset_triangle_yg,
            color="yellow",
            poly_points=points_triangle_yg,
            layers=2,
            is_extension=True)

        self.orientation = orientation
        if (sens == 'r'):
            self.__coucher_a_gauche = 'y'
            self.__coucher_a_droite = 'r'
        else:
            self.__coucher_a_gauche = 'r'
            self.__coucher_a_droite = 'y'
        self.__is_down = False
        self.__extension_down = None  #variable qui stock l'extension utilisée pour coucher le feu
        self.__eteindre_flag = False