public class TetrixMotorController extends I2CSensor
TetrixMotor and TetrixEncoderMotor instances
which are used to control the Tetrix motors.
Use to retrieve a TetrixControllerFactory.newMotorController()TetrixMotorController instance.
TetrixControllerFactory,
TetrixMotor,
TetrixEncoderMotor| Modifier and Type | Field and Description |
|---|---|
static int |
MOTOR_1
Represents Motor 1 as indicated on the controller
|
static int |
MOTOR_2
Represents Motor 2 as indicated on the controller
|
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCountcurrentMode, modesBLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW| Constructor and Description |
|---|
TetrixMotorController(I2CPort port,
int daisyChainPosition)
Instantiate a HiTechnic TETRIX Motor Controller connected to the given
port and daisy chain position. |
| Modifier and Type | Method and Description |
|---|---|
TetrixMotor |
getBasicMotor(int motorID)
Get a
TetrixMotor instance that is associated with the motorID. |
TetrixEncoderMotor |
getEncoderMotor(int motorID)
Get a
TetrixEncoderMotor instance that is associated with the motorID. |
TetrixRegulatedMotor |
getRegulatedMotor(int motorID)
Get a
TetrixRegulatedMotor instance that is associated with the motorID. |
float |
getVoltage()
Return the current battery voltage supplied to the controller.
|
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCountfetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModesclose, releaseOnClosepublic static final int MOTOR_1
public static final int MOTOR_2
public TetrixMotorController(I2CPort port, int daisyChainPosition)
port and daisy chain position.port - The sensor port the controller (if daisy-chained, the first) is connected to.daisyChainPosition - The position of the controller in the daisy chain.java.lang.IllegalStateException - if a Motor Controller was not found with given port and daisyChainPositionTetrixControllerFactory.DAISY_CHAIN_POSITION_1,
TetrixControllerFactory.DAISY_CHAIN_POSITION_2,
TetrixControllerFactory.DAISY_CHAIN_POSITION_3,
TetrixControllerFactory.DAISY_CHAIN_POSITION_4public TetrixMotor getBasicMotor(int motorID)
TetrixMotor instance that is associated with the motorID.motorID - The motor ID number. This is indicated on the HiTechnic Motor Controller and is
represented using MOTOR_1 or MOTOR_2.TetrixMotor instancejava.lang.IllegalArgumentException - if invalid motorIDjava.lang.UnsupportedOperationException - if motorID has already been used for a Tetrix motor instance
other than TetrixMotor.TetrixMotor,
getEncoderMotor(int),
getRegulatedMotor(int)public TetrixEncoderMotor getEncoderMotor(int motorID)
TetrixEncoderMotor instance that is associated with the motorID. The motor must
have an encoder installed for a TetrixEncoderMotor instance to work correctly.motorID - The motor ID number. This is indicated on the HiTechnic Motor Controller and is
represented using MOTOR_1 or MOTOR_2.TetrixEncoderMotor instancejava.lang.IllegalArgumentException - if invalid motorIDjava.lang.UnsupportedOperationException - if motorID has already been used for a Tetrix motor instance
other than TetrixEncoderMotor.TetrixEncoderMotor,
getBasicMotor(int),
getRegulatedMotor(int)public TetrixRegulatedMotor getRegulatedMotor(int motorID)
TetrixRegulatedMotor instance that is associated with the motorID. The motor must
have an encoder installed for a TetrixRegulatedMotor instance to work correctly.motorID - The motor ID number. This is indicated on the HiTechnic Motor Controller and is
represented using MOTOR_1 or MOTOR_2.TetrixRegulatedMotor instancejava.lang.IllegalArgumentException - if invalid motorIDjava.lang.UnsupportedOperationException - if motorID has already been used for a Tetrix motor instance
other than TetrixRegulatedMotor.TetrixRegulatedMotor,
getBasicMotor(int),
getEncoderMotor(int)public float getVoltage()