RoboClawMotor(final RoboClaw aThis, final int aMotorId) { mMotorController = aThis; mMotorId = aMotorId; mAbsoluteEncoder = false; mSupportRCEncoders = false; mBufferLength = 0; mSpeedServo = new SpeedServo(this); // mMotorController.handleCommand( // new CommandSetPIDQPPSConstants( // mMotorId, // 0x00010000, // 0x00008000, // 0x00004000, // 44000) // ); // mMotorController.handleCommand(new CommandReadPIDQPPS(this)); LOGGER.log( Level.SEVERE, "Motor id : p = " + mPConstant + " i = " + mIConstant + " d = " + mDConstant + " qpps " + mQPPSConstant); }
/** * This method calls the RoboClaw to obtain the quadrature encoder position and returns the number * of encoder pulses. * * @return The count of pulses since the last reset of the quadrature encoder for this motor. */ public long getEncoderPosition() { long[] encoderPosition = new long[2]; mMotorController.handleCommand(new CommandReadEncoderPosition(mMotorId, encoderPosition)); return encoderPosition[0]; }
public double getVoltage() { return mMotorController.getMainBatteryVoltage(); }
/** * This method returns the actual speed of the motor in terms of 'pulses-per-second'. * * @return The number of pulses per second. */ public long getEncoderSpeed() { long[] encoderSpeed = new long[1]; mMotorController.handleCommand(new CommandReadEncoderSpeed(mMotorId, encoderSpeed)); return encoderSpeed[0]; }
public void setDutyCycle(final double aDutyCycle) { mDutyCycle = aDutyCycle; mMotorController.handleCommand(new CommandDriveMotorWithDutyCycle(mMotorId, mDutyCycle)); }