def get_servo_position(self):
        """ Gets the current position of Herkulex

        Args:
            none

        Returns:
            int: position of the servo- 0 to 1023

        Raises:
            SerialException: Error occured while opening serial port

        """
        #global SERPORT

        data = []
        data.append(0x09)
        data.append(self.servoid)
        data.append(RAM_READ_REQ)
        data.append(CALIBRATED_POSITION_RAM)
        data.append(BYTE2)
        send_data(data)
        rxdata = []
        try:
            rxdata = SERPORT.read(13)
            if (self.servomodel==0x06) or (self.servomodel == 0x04):
                return ((ord(rxdata[10])&0xff)<<8) | (ord(rxdata[9])&0xFF)
            else:
                #print ord(rxdata[9]),ord(rxdata[10])
                return ((ord(rxdata[10])&0x03)<<8) | (ord(rxdata[9])&0xFF)

        except HerkulexError:
            print "Could not read from the servos. Check connection"
def get_servo_position ( self ) : data = [ ] data . append ( 0x09 ) data . append ( self . servoid ) data . append ( RAM_READ_REQ ) data . append ( CALIBRATED_POSITION_RAM ) data . append ( BYTE2 ) send_data ( data ) rxdata = [ ] try : rxdata = SERPORT . read ( 13 ) if ( self . servomodel == 0x06 ) or ( self . servomodel == 0x04 ) : return ( ( ord ( rxdata [ 10 ] ) & 0xff ) << 8 ) | ( ord ( rxdata [ 9 ] ) & 0xFF ) else : return ( ( ord ( rxdata [ 10 ] ) & 0x03 ) << 8 ) | ( ord ( rxdata [ 9 ] ) & 0xFF ) except HerkulexError : print "Could not read from the servos. Check connection"
Gets the current position of Herkulex

        Args:
            none

        Returns:
            int: position of the servo- 0 to 1023

        Raises:
            SerialException: Error occured while opening serial port