Go to the documentation of this file.00001 import struct
00002 from BAL.Header.Response.ParamBuildResponse import ParamBuildResponse, CloseDiffFour
00003
00004 __author__ = 'tom1231'
00005 MSG_LEN = 42
00006
00007
00008 class CloseDIffFourParamResponse(ParamBuildResponse):
00009 def __init__(self, devId, param):
00010 ParamBuildResponse.__init__(self, CloseDiffFour, devId, param.getCloseDiffPubHz())
00011 self._length = MSG_LEN
00012 self._checkSum = 0
00013 self._rWheel = param.getCloseDiffRWheel()
00014 self._width = param.getCloseDiffWidth()
00015 self._motorFL = param.getCloseDiffMotorFL()
00016 self._motorFR = param.getCloseDiffMotorFR()
00017 self._motorBL = param.getCloseDiffMotorBL()
00018 self._motorBR = param.getCloseDiffMotorBR()
00019 self._slip = param.getCloseDiffSlip()
00020 self._checkSum = self.calCheckSum(self.dataTosend())
00021
00022 def dataTosend(self):
00023 return ParamBuildResponse.dataTosend(self) \
00024 + struct.pack('<f', self._rWheel) \
00025 + struct.pack('<f', self._width) \
00026 + struct.pack('<i', self._motorFL) \
00027 + struct.pack('<i', self._motorFR) \
00028 + struct.pack('<i', self._motorBL) \
00029 + struct.pack('<i', self._motorBR) \
00030 + struct.pack('<f', self._slip)