00001 __author__ = 'tom1231' 00002 from BAL.Header.RiCHeader import RiCHeader 00003 import struct 00004 00005 REQ_LEN = 11 00006 00007 class CloseMotorRequest(RiCHeader): 00008 def __init__(self, motorNum, postion): 00009 RiCHeader.__init__(self) 00010 self._id = 6 00011 self._length = REQ_LEN 00012 self._des = 0x1001 00013 self._checkSum = 0 00014 self._motorId = motorNum 00015 self._position = postion 00016 self._checkSum = self.calCheckSum(self.dataTosend()) 00017 00018 00019 def dataTosend(self): 00020 return RiCHeader.dataTosend(self) \ 00021 + struct.pack('<B', self._motorId) \ 00022 + struct.pack('<f', self._position)