def createCLMotors(self): closeMotorsAmount = self._param.getCloseLoopMotorSize() for motorNum in xrange(closeMotorsAmount): rospy.loginfo("Configuring motor: %s", self._param.getCloseLoopMotorName(motorNum)) motor = RiCCloseLoopMotor(motorNum, self._param, self._output) self._allDevs['motorsCl'].append(motor) if self._param.getCloseLoopMotorEncoderType(motorNum) == 1: toSend = CloseLoopMotorBuildResponse(motorNum, self._param, EngineCL) else: toSend = CloseLoopMotorTwoEncBuildResponse(motorNum, self._param, EngineCL2) self._output.writeAndWaitForAck(toSend.dataTosend(), motorNum) rospy.loginfo("Motor: %s is ready", self._param.getCloseLoopMotorName(motorNum))
def createCLMotors(self): closeMotorsAmount = self._param.getCloseLoopMotorSize() for motorNum in xrange(closeMotorsAmount): rospy.loginfo("Configuring motor: %s", self._param.getCloseLoopMotorName(motorNum)) motor = RiCCloseLoopMotor(motorNum, self._param, self._output) self._allDevs['motorsCl'].append(motor) if self._param.getCloseLoopMotorEncoderType(motorNum) == 1: toSend = CloseLoopMotorBuildResponse(motorNum, self._param, EngineCL) else: toSend = CloseLoopMotorTwoEncBuildResponse( motorNum, self._param, EngineCL2) self._output.writeAndWaitForAck(toSend.dataTosend(), motorNum) rospy.loginfo("Motor: %s is ready", self._param.getCloseLoopMotorName(motorNum))
def dataTosend(self): return CloseLoopMotorBuildResponse.dataTosend(self) \ + struct.pack('<I', self._encoderPin2A) \ + struct.pack('<I', self._encoderPin2B)