コード例 #1
0
 def __init__(self, id_, data):
     CircleObject.__init__(self,
                           id_)  # Do not forget to call super constructor
     self.regrow_time = 100
     self.cur_regrow = 0
     self.triggered = False
     self.rob = Pyroborobo.get()  # Get pyroborobo singleton
コード例 #2
0
 def __init__(self, id, data):
     CircleObject.__init__(self, id)  # Do not forget to call super constructor
     self.regrow_time = data['regrowTimeMax']
     self.cur_regrow = 0
     self.triggered = False
     self.gate_id = data['sendMessageTo']
     self.rob = Pyroborobo.get()  # Get pyroborobo singleton
コード例 #3
0
ファイル: gather_example.py プロジェクト: nekonaute/roborobo4
 def __init__(self, world_model):
     self.rot_speed = 0.5
     # It is *mandatory* to call the super constructor before any other operation to
     # link the python object to its C++ counterpart
     Controller.__init__(self, world_model)
     self.rob = Pyroborobo.get()
     print("I'm a Python controller")
コード例 #4
0
 def __init__(self, world_model):
     # It is *mandatory* to call the super constructor before any other operation to
     # link the python object to its C++ counterpart
     Controller.__init__(self, world_model)
     self.rob = Pyroborobo.get()
     self.camera_max_range = 0
     self.repulse_radius = 0
     self.orientation_radius = 0
コード例 #5
0
 def __init__(self, id_: int, data: dict):
     CircleObject.__init__(self, id_)
     self.rob = Pyroborobo.get()
     print(data)
     self.message = data.get("sendMessageTo", 0)
     self.triggered = False
     self.regrow_time = 0
     self.regrow_time_max = data['regrowTimeMax']
コード例 #6
0
 def __init__(self, wm):
     super().__init__(wm)
     self.weights = None
     self.received_weights = dict()
     self.rob = Pyroborobo.get()
     self.next_gen_every_it = 400
     self.deactivated = False
     self.next_gen_in_it = self.next_gen_every_it
コード例 #7
0
 def __init__(self, world):
     super().__init__(world)
     self.rob = Pyroborobo.get()
     self.global_fit = 0
     self.pointCount = 0
     self.reference_function = 0
     self.next_id_obj = 8
     self.nb_objects = 25
     self.feuille = []
コード例 #8
0
 def __init__(self, wm):
     super().__init__(wm)
     self.weights = None
     self.received_weights = dict()
     self.rob = Pyroborobo.get()
     self.next_gen_every_it = 400
     self.deactivated = False
     self.next_gen_in_it = self.next_gen_every_it
     self._cur_inputs = None  # pre-allocate inputs to avoid too much copy
     self.distances = None
     self.distances = None
     self.is_robots = None
     self.is_walls = None
     self.is_objects = None
     self.robot_controllers = None
     self.prev_dist = np.array([0])
コード例 #9
0
    def step(self):
        self.cur_it -= 1
        if self.cur_it < 0:
            x, y = self.position
            new_x, new_y = x + 20, y
            if Pyroborobo.get().iterations < 200:
                try:
                    self.radius = 100
                except RuntimeError:
                    print(
                        "[ERROR FOR THE EXAMPLE] Cannot work, object not unregistered first"
                    )

            self.unregister()
            success = self.set_coordinates(new_x, new_y)
            if not success:
                self.set_coordinates(self.default_x, self.default_y)
            self.register()
            self.cur_it = self.move_every
コード例 #10
0
ファイル: objects.py プロジェクト: Cornede/PANDROIDE
 def __init__(self, id=-1, data={}):
     super().__init__(id,data)
     self.set_color(0, 255, 0)
     self.type = 4
     self.regrow_time = 50
     self.cur_regrow = 0
     self.data = data
     self.x = 0
     self.y = 0
     self.new_x = 0
     self.new_y = 0
     self.take = True
     
     #self.default_x = copy.copy(data["x"])
     #self.default_y = copy.copy(data["y"])
     self.rob = Pyroborobo.get() # Get pyroborobo singleton
     
     self.dropped_in_nest = False
     self.dropped = False
     self.nbRobot = 0 # nombre de robot qui l'ont transporté jusqu'a présent
コード例 #11
0
 def __init__(self, wm):
     super().__init__(wm)
     self.writer = None
     self.rob = Pyroborobo.get()
コード例 #12
0
 def __init__(self, world_model):
     # Obligatory call to super.__init__ to avoid segfault
     DistAwareController.__init__(self, world_model)
     print("Hello, I'm a custom DistAwareController")
     self.rob = Pyroborobo.get()
コード例 #13
0
 def __init__(self, wm):
     super().__init__(wm)
     self.rob = Pyroborobo.get()
     assert self.nb_sensors == 8, "SimpleController only works with 8 sensors"
     self.rotspeed = 0.5
コード例 #14
0
 def __init__(self, id_, data):
     SquareObject.__init__(self, id_)
     self.rob = Pyroborobo.get()
     self.triggered = False
     self.regrow_time_max = data['regrowTimeMax']
     self.regrow_time = 0
コード例 #15
0
 def __init__(self, wm):
     super().__init__(wm)
     self.arena_size = Pyroborobo.get().arena_size
コード例 #16
0
 def __init__(self, world):
     super().__init__(world)
     rob = Pyroborobo.get()
コード例 #17
0
 def __init__(self, wm):
     super().__init__(wm)
     self.rob = Pyroborobo.get()
     self.last_rob_met = -1
     self.last_obj_met = -1
     self.arena_mid_x, self.arena_mid_y = np.array(self.rob.arena_size) / 2