Exemplo n.º 1
0
    def get_ranges(self):
        """Requests the last measurements of all sensors"""
        cmd = I2C.pack8(Command.MeasureAll, 0)
        self.send(cmd)
        data = self.receive(2 * self.n)

        ranges = list()
        for i in range(self.n):
            j = i * 2
            ranges.append(I2C.pack16(data[(i * 2) + 1], data[i * 2]))
        return ranges
Exemplo n.º 2
0
 def get_number_of_sensors(self):
     """Requests the number of available sensors"""
     cmd = I2C.pack8(Command.Count, 0)
     self.send(cmd)
     return self.receive()
 def get_ranges(self):
     """Requests the last measurements of all sensors"""
     cmd = I2C.pack8(Command.MeasureAll, 0)
     self.send(cmd)
     return self.receive(2 * self.n)
Exemplo n.º 4
0
 def get_range(self, sensor):
     """Requests the last measurement of a specific sensor"""
     cmd = I2C.pack8(Command.MeasureOne, sensor)
     self.send(cmd)
     r = self.receive(2)
     return I2C.pack16(r[1], r[0])
Exemplo n.º 5
0
 def launch_funny(self):
     cmd = I2C.pack8(Adress.SERVO_FUNNY, Command.MOVE_UP)
     self.send(cmd)
Exemplo n.º 6
0
 def reset_funny(self):
     cmd = I2C.pack8(Adress.SERVO_FUNNY, Command.MOVE_DOWN)
     self.send(cmd)
Exemplo n.º 7
0
 def push_out(self):
     cmd = I2C.pack8(Adress.SERVO_PUSH, Command.MOVE_UP)
     self.send(cmd)
Exemplo n.º 8
0
 def push_back(self):
     cmd = I2C.pack8(Adress.SERVO_PUSH, Command.MOVE_DOWN)
     self.send(cmd)
Exemplo n.º 9
0
 def open_clamp(self):
     cmd = I2C.pack8(Adress.SERVO_CLAMP, Command.MOVE_DOWN)
     self.send(cmd)
Exemplo n.º 10
0
 def close_clamp(self):
     cmd = I2C.pack8(Adress.SERVO_CLAMP, Command.MOVE_UP)
     self.send(cmd)
Exemplo n.º 11
0
 def middle_clamp(self):
     self.send(I2C.pack8(Adress.SERVO_DYNAMIXEL, 2))
Exemplo n.º 12
0
 def down_clamp(self):
     cmd = I2C.pack8(Adress.SERVO_DYNAMIXEL, Command.MOVE_DOWN)
     self.send(cmd)
Exemplo n.º 13
0
 def up_clamp(self):
     cmd = I2C.pack8(Adress.SERVO_DYNAMIXEL, Command.MOVE_UP)
     self.send(cmd)