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
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)
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])
def launch_funny(self): cmd = I2C.pack8(Adress.SERVO_FUNNY, Command.MOVE_UP) self.send(cmd)
def reset_funny(self): cmd = I2C.pack8(Adress.SERVO_FUNNY, Command.MOVE_DOWN) self.send(cmd)
def push_out(self): cmd = I2C.pack8(Adress.SERVO_PUSH, Command.MOVE_UP) self.send(cmd)
def push_back(self): cmd = I2C.pack8(Adress.SERVO_PUSH, Command.MOVE_DOWN) self.send(cmd)
def open_clamp(self): cmd = I2C.pack8(Adress.SERVO_CLAMP, Command.MOVE_DOWN) self.send(cmd)
def close_clamp(self): cmd = I2C.pack8(Adress.SERVO_CLAMP, Command.MOVE_UP) self.send(cmd)
def middle_clamp(self): self.send(I2C.pack8(Adress.SERVO_DYNAMIXEL, 2))
def down_clamp(self): cmd = I2C.pack8(Adress.SERVO_DYNAMIXEL, Command.MOVE_DOWN) self.send(cmd)
def up_clamp(self): cmd = I2C.pack8(Adress.SERVO_DYNAMIXEL, Command.MOVE_UP) self.send(cmd)