Go to the documentation of this file.00001 import struct
00002
00003 __author__ = 'tom1231'
00004 from BAL.Header.Response.ParamBuildResponse import ParamBuildResponse, SERVO
00005
00006
00007 SERVO_LEN_MSG = 38
00008
00009 class BuildServoResponse(ParamBuildResponse):
00010 def __init__(self, devId, param):
00011 ParamBuildResponse.__init__(self, SERVO, devId, param.getServoPublishHz(devId))
00012 self._length = SERVO_LEN_MSG
00013 self._port = param.getServoPort(devId)
00014 self._min = param.getServoMin(devId)
00015 self._max = param.getServoMax(devId)
00016 self._a = param.getServoAParameter(devId)
00017 self._b = param.getServoBParameter(devId)
00018 self._initPos = param.getServoInitMove(devId)
00019
00020 self._checkSum = 0
00021 self._checkSum = self.calCheckSum(self.dataTosend())
00022
00023 def dataTosend(self):
00024 return ParamBuildResponse.dataTosend(self)\
00025 + struct.pack('<i', self._port)\
00026 + struct.pack('<f', self._min)\
00027 + struct.pack('<f', self._max)\
00028 + struct.pack('<f', self._a)\
00029 + struct.pack('<f', self._b)\
00030 + struct.pack('<f', self._initPos)
00031
00032 def getDevId(self):
00033 return self._devId
00034
00035
00036
00037
00038
00039