public void setGearRatio(int motor, double ratio) {
   m57a(motor);
   Range.throwIfRangeIsInvalid(ratio, HiTechnicNxtCompassSensor.INVALID_DIRECTION, 1.0d);
   int i = ADDRESS_MOTOR_GEAR_RATIO_MAP[motor];
   byte[] bArr = new byte[MIN_MOTOR];
   bArr[0] = (byte) ((int) (127.0d * ratio));
   write(i, bArr);
 }
 public void setMotorPower(int motor, double power) {
   m57a(motor);
   Range.throwIfRangeIsInvalid(power, HiTechnicNxtCompassSensor.INVALID_DIRECTION, 1.0d);
   int i = ADDRESS_MOTOR_POWER_MAP[motor];
   byte[] bArr = new byte[MIN_MOTOR];
   bArr[0] = (byte) ((int) (100.0d * power));
   write(i, bArr);
 }
 public void setMotorTargetPosition(int motor, int position) {
   m57a(motor);
   Range.throwIfRangeIsInvalid((double) position, -2.147483648E9d, 2.147483647E9d);
   write(ADDRESS_MOTOR_TARGET_ENCODER_VALUE_MAP[motor], TypeConversion.intToByteArray(position));
 }
Ejemplo n.º 4
0
 public Gamepad getGamepad(int port) {
   Range.throwIfRangeIsInvalid((double) port, 0.0D, 1.0D);
   return this.gamepads[port];
 }