import serial

class Servos():
    '''
    Base functions for controlling a Pololu Micro Maestro 6 servo controller.
    Reference: http://www.pololu.com/docs/0J40
    '''
    def __init__(self, usb_device):
        self.device = serial.Serial(usb_device)

    def self.get_highlow(self, value):
        return [(value & 0x7F), ((140 >> 7) & 0x7F)]

    def self.set_acceleration(self, servo, value):
        return bytes([0x89,servo] + get_highlow(value))

    def self.set_speed(self, servo, value):
        return bytes([0x87,servo] + get_highlow(value))    

    def self.go_home():
        return bytes(0xA2) 

    def self.set_pos(self, servo, value):
        if value < 254 and value >= 0:
            return bytes([0xFF,servo, value]) 

    def self.set_pos_percent(self, servo, value):
        if value <=100 and value >=0:
            return bytes([0xFF,servo, int(value * 2.54)]) 


    def self.move_percent(self, x,y):
        ser.write(set_pos_percent(0,x))
        ser.write(set_pos_percent(1,y))

if __name__ == '__main__':
    test = Servos('/dev/serial/by-id/usb-Pololu_Corporation_Pololu_Micro_Maestro_6-Servo_Controller_00065299-if00')

@@ -6,16 +6,30 @@
 t serial
+%0Aimport struct
 %0A%0Aclass 
@@ -281,87 +281,429 @@
 elf.
-get_highlow(self, value):%0A        return %5B(value & 0x7F), ((140 %3E%3E 7) & 0x7F)%5D%0A
+read_out(self, rsize):%0A        out = b''%0A        while self.device.inWaiting():%0A            out += self.device.read(rsize)%0A        return out%0A%0A    // returns high/low rep of int value%0A    def self.get_highlow(self, value):%0A        return %5B(value & 0x7F), ((140 %3E%3E 7) & 0x7F)%5D%0A%0A    // returns int rep of the high/low value %0A    def self.conv_highlow(self, value):%0A        return struct.unpack('H', value)%5B0%5D%0A%0A    // easing
 %0A   
@@ -778,32 +778,37 @@
 (%5B0x89,servo%5D + 
+self.
 get_highlow(valu
@@ -812,16 +812,54 @@
 alue))%0A%0A
+    // max speed for set_acceleration%0A
     def 
@@ -930,16 +930,21 @@
 ervo%5D + 
+self.
 get_high
@@ -960,16 +960,39 @@
 ))    %0A%0A
+    // move to neutral%0A
     def 
@@ -1032,24 +1032,53 @@
 tes(0xA2) %0A%0A
+    // move to point %3Cvalue%3E%0A
     def self
@@ -1342,16 +1342,528 @@
 54)%5D) %0A%0A
+    def self.get_pos(self, servo):%0A        self.device.write(bytes(%5B0x90, servo%5D))%0A        out = self.read_out(2)%0A        if out:%0A            return self.conv_highlow(out)%0A%0A    def self.get_mov_state(self):%0A        self.device.write(bytes(%5B0x93%5D))%0A        out = self.read_out(1)%0A        if out == 0x01:%0A            return True%0A        return False%0A%0A    def self.get_error(self):%0A        self.device.write(bytes(%5B0x93%5D))%0A        out = self.read_out(2)%0A        if out != bytes(%5B0x00,0x00%5D):%0A            return out%0A
 %0A    def
@@ -1899,32 +1899,45 @@
 :%0A        se
-r
+lf.device
 .write(
+self.
 set_pos_perc
@@ -1960,16 +1960,29 @@
   se
-r
+lf.device
 .write(
+self.
 set_

Update servo_pololu_coms.py