Example #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()
Example #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())
Example #3
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)])
		)
Example #4
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)])
		)
Example #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
Example #6
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
Example #7
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
Example #8
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
Example #9
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
Example #10
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
Example #11
0
    def __init__(self, *, engine, posinit, team):
        #extension pour donner un signe distinctif au robot pour reconnaitre l'avant
        self.avant = EngineObjectPoly(
            engine=engine,
            colltype=COLLTYPE_PETIT_ROBOT,
            offset=mm_to_px(HEIGHT_MINI / 2, -WIDTH_MINI / 2),
            color="black",
            poly_points=map(lambda p: mm_to_px(*p),
                            [(0, 0), (0, WIDTH_MINI), (-10, WIDTH_MINI),
                             (-10, 0)]),  #taille du bras
            is_extension=True)

        self.bras_gauche = EngineObjectPoly(
            engine=engine,
            colltype=COLLTYPE_BRAS_PETIT,
            offset=mm_to_px(HEIGHT_MINI / 2 - 10, -WIDTH_MINI + 35),
            color="purple",
            poly_points=map(lambda p: mm_to_px(*p),
                            [(0, 0), (10, 0), (10, 70),
                             (0, 70)]),  #taille du bras
            is_extension=True)

        self.bras_droite = EngineObjectPoly(
            engine=engine,
            colltype=COLLTYPE_BRAS_PETIT,
            offset=mm_to_px(HEIGHT_MINI / 2 - 10, WIDTH_MINI / 2),
            color="purple",
            poly_points=map(lambda p: mm_to_px(*p),
                            [(0, 0), (10, 0), (10, 70),
                             (0, 70)]),  #taille du bras
            is_extension=True)

        robot.Robot.__init__(
            self,
            engine=engine,
            team=team,
            posinit=posinit,
            mass=10,
            typerobot=MINI,
            colltype=COLLTYPE_PETIT_ROBOT,
            poly_points=mm_to_px((0, 0), (HEIGHT_MINI, 0),
                                 (HEIGHT_MINI, WIDTH_MINI), (0, WIDTH_MINI)),
        )

        self.add_body_extension(self.avant)
        self.__bras_used = None  #pour savoir quel bras est sorti
        self.__nbr_lances = 6
        self.__filet = 1
        self.__fresques = 2
        self.setRobotType(MINI)
Example #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
Example #13
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
		)
Example #14
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
Example #15
0
	def __init__(self, *, engine, posinit, team):
		self.bras = EngineObjectPoly(
			engine 		= engine,
			colltype	= COLLTYPE_BRAS,
			offset		= mm_to_px(WIDTH_GROS/2-21, -HEIGHT_GROS/2-24),
			color		= "green",
			poly_points = map(lambda p: mm_to_px(*p),[(LONGUEUR_BRAS,0),(0,LONGUEUR_BRAS), (0,0)]), #taille du bras
			is_extension= True
		)

		self.bras_ouvrir = EngineObjectPoly(
			engine 		= engine,
			colltype	= COLLTYPE_BRAS_OUVRIR,
			offset		= mm_to_px(WIDTH_GROS/2-21, -HEIGHT_GROS/2-24),
			color		= "purple",
			poly_points = map(lambda p: mm_to_px(*p),[(LONGUEUR_BRAS,0),(0,LONGUEUR_BRAS), (0,0)]), #taille du bras
			is_extension= True
		)

		self.bras_fermer = EngineObjectPoly(
			engine 		= engine,
			colltype	= COLLTYPE_BRAS_FERMER,
			offset		= mm_to_px(WIDTH_GROS/2-21, -HEIGHT_GROS/2-24),
			color		= "blue",
			poly_points = map(lambda p: mm_to_px(*p),[(LONGUEUR_BRAS,0),(0,LONGUEUR_BRAS), (0,0)]), #taille du bras
			is_extension= True
		)

		robot.Robot.__init__(self,
			engine		 		= engine,
			team				= team,
			posinit				= posinit,
			mass				= 10,
			typerobot			= BIG,
			colltype 			= COLLTYPE_GROS_ROBOT,
			poly_points			= mm_to_px((0,0),(HEIGHT_GROS,0),(HEIGHT_GROS,WIDTH_GROS-95),(HEIGHT_GROS-115,WIDTH_GROS),(0,WIDTH_GROS)),
			extension_objects	= [],
		)
		self.__nbrFeuAvant = 0
		self.__nbrFeuArriere = 0
		self.__engine = engine
		self.__feuHit = 0
		self.__feuHit_forced = False
		self.setRobotType(BIG)
Example #16
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
Example #17
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
Example #18
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)
Example #19
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
Example #20
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