コード例 #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
コード例 #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()
コード例 #3
0
 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)
コード例 #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])
コード例 #5
0
 def launch_funny(self):
     cmd = I2C.pack8(Adress.SERVO_FUNNY, Command.MOVE_UP)
     self.send(cmd)
コード例 #6
0
 def reset_funny(self):
     cmd = I2C.pack8(Adress.SERVO_FUNNY, Command.MOVE_DOWN)
     self.send(cmd)
コード例 #7
0
 def push_out(self):
     cmd = I2C.pack8(Adress.SERVO_PUSH, Command.MOVE_UP)
     self.send(cmd)
コード例 #8
0
 def push_back(self):
     cmd = I2C.pack8(Adress.SERVO_PUSH, Command.MOVE_DOWN)
     self.send(cmd)
コード例 #9
0
 def open_clamp(self):
     cmd = I2C.pack8(Adress.SERVO_CLAMP, Command.MOVE_DOWN)
     self.send(cmd)
コード例 #10
0
 def close_clamp(self):
     cmd = I2C.pack8(Adress.SERVO_CLAMP, Command.MOVE_UP)
     self.send(cmd)
コード例 #11
0
 def middle_clamp(self):
     self.send(I2C.pack8(Adress.SERVO_DYNAMIXEL, 2))
コード例 #12
0
 def down_clamp(self):
     cmd = I2C.pack8(Adress.SERVO_DYNAMIXEL, Command.MOVE_DOWN)
     self.send(cmd)
コード例 #13
0
 def up_clamp(self):
     cmd = I2C.pack8(Adress.SERVO_DYNAMIXEL, Command.MOVE_UP)
     self.send(cmd)