Пример #1
0
  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);
  }
Пример #2
0
 /**
  * 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];
 }
Пример #3
0
 public double getVoltage() {
   return mMotorController.getMainBatteryVoltage();
 }
Пример #4
0
 /**
  * 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];
 }
Пример #5
0
 public void setDutyCycle(final double aDutyCycle) {
   mDutyCycle = aDutyCycle;
   mMotorController.handleCommand(new CommandDriveMotorWithDutyCycle(mMotorId, mDutyCycle));
 }