ServoPublishResponse.py
Go to the documentation of this file.
00001 import struct
00002 
00003 __author__ = 'tom1231'
00004 from BAL.Header.RiCHeader import RiCHeader
00005 
00006 SERVO_NUM_PLACE = 7
00007 SERVO_POSITION_PLACE = 11
00008 
00009 
00010 class ServoPublishResponse(RiCHeader):
00011     def __init__(self):
00012         RiCHeader.__init__(self)
00013         self._servoNum = 0
00014         self._position = 0.0
00015 
00016     def buildRequest(self, data):
00017         RiCHeader.buildRequest(self, data)
00018         bytes = bytearray()
00019         while self.index < SERVO_NUM_PLACE:
00020             bytes.append(data[self.index])
00021             self.index += 1
00022         self._servoNum = struct.unpack('<B', bytes)[0]
00023         bytes = bytearray()
00024         while self.index < SERVO_POSITION_PLACE:
00025             bytes.append(data[self.index])
00026             self.index += 1
00027         self._position = struct.unpack('<f', bytes)[0]
00028 
00029     def getServoNum(self): return self._servoNum
00030 
00031     def getServoPos(self): return self._position
00032 


ric_board
Author(s): RoboTiCan
autogenerated on Fri Oct 27 2017 03:02:31