CloseLoopMotorTwoEncBuildResponse.py
Go to the documentation of this file.
00001 import struct
00002 from BAL.Header.Response.closeLoopMotorBuildResponse import CloseLoopMotorBuildResponse, EN_PORT1, EN_PORT2, EN_PORT3
00003 from BAL.Header.Response.ParamBuildResponse import EngineCL2
00004 
00005 __author__ = 'tom1231'
00006 
00007 LEN_MSG = 90
00008 
00009 
00010 class CloseLoopMotorTwoEncBuildResponse(CloseLoopMotorBuildResponse):
00011     def __init__(self, devId, param, type):
00012         CloseLoopMotorBuildResponse.__init__(self, devId, param, type)
00013         self._length = LEN_MSG
00014         port = param.getCloseLoopMotorPort2(devId)
00015 
00016         if port == EN_PORT1:
00017             self._encoderPin2A = 20
00018             self._encoderPin2B = 21
00019         elif port == EN_PORT2:
00020             self._encoderPin2A = 22
00021             self._encoderPin2B = 23
00022         elif port == EN_PORT3:
00023             self._encoderPin2A = 27
00024             self._encoderPin2B = 28
00025         else:
00026             self._encoderPin2A = 29
00027             self._encoderPin2B = 30
00028 
00029         self._checkSum = 0
00030         self._checkSum = self.calCheckSum(self.dataTosend())
00031 
00032     def dataTosend(self):
00033         return CloseLoopMotorBuildResponse.dataTosend(self) \
00034                + struct.pack('<I', self._encoderPin2A) \
00035                + struct.pack('<I', self._encoderPin2B)
00036 


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