public interface DeviceManager
Modifier and Type | Interface and Description |
---|---|
static class |
DeviceManager.DeviceType
Enum of known USB Device Types (Note that the MR .AAR library has an internal copy of this)
|
Modifier and Type | Method and Description |
---|---|
ColorSensor |
createAdafruitI2cColorSensor(I2cController controller,
int channel)
Create an instance of a ColorSensor
|
AnalogInput |
createAnalogInputDevice(AnalogInputController controller,
int channel) |
OpticalDistanceSensor |
createAnalogOpticalDistanceSensor(AnalogInputController analogInputController,
int physicalPort)
Create an instance of an OpticalDistanceSensor
|
AnalogOutput |
createAnalogOutputDevice(AnalogOutputController controller,
int channel) |
CRServo |
createCRServo(ServoController controller,
int portNumber) |
DcMotor |
createDcMotor(DcMotorController controller,
int portNumber)
Create an instance of a DcMotor
|
DcMotor |
createDcMotorEx(DcMotorController controller,
int portNumber) |
DeviceInterfaceModule |
createDeviceInterfaceModule(SerialNumber serialNumber) |
DigitalChannel |
createDigitalChannelDevice(DigitalChannelController controller,
int channel) |
TouchSensor |
createDigitalTouchSensor(DeviceInterfaceModule deviceInterfaceModule,
int physicalPort)
Create an instance of a TouchSensor
|
I2cDevice |
createI2cDevice(I2cController controller,
int channel) |
IrSeekerSensor |
createI2cIrSeekerSensorV3(I2cController i2cController,
int physicalPort)
Create an instance of a IrSeekerSensorV3
|
LED |
createLED(DigitalChannelController controller,
int channel)
Create an instance of an LED
|
ColorSensor |
createModernRoboticsI2cColorSensor(I2cController controller,
int channel)
Create an instance of a ColorSensor
|
GyroSensor |
createModernRoboticsI2cGyroSensor(I2cController i2cController,
int physicalPort)
Create an instance of a GyroSensor
|
AccelerationSensor |
createNxtAccelerationSensor(LegacyModule legacyModule,
int physicalPort)
Create an instance of a AccelerationSensor
|
ColorSensor |
createNxtColorSensor(LegacyModule controller,
int channel)
Create an instance of a ColorSensor
|
CompassSensor |
createNxtCompassSensor(LegacyModule legacyModule,
int physicalPort)
Create an instance of a NxtCompassSensor
|
DcMotorController |
createNxtDcMotorController(LegacyModule legacyModule,
int physicalPort)
Create an instance of an NXT DcMotorController
|
GyroSensor |
createNxtGyroSensor(LegacyModule legacyModule,
int physicalPort)
Create an instance of a GyroSensor
|
IrSeekerSensor |
createNxtIrSeekerSensor(LegacyModule legacyModule,
int physicalPort)
Create an instance of a IrSeekerSensor
|
LightSensor |
createNxtLightSensor(LegacyModule legacyModule,
int physicalPort)
Create an instance of a LightSensor
|
ServoController |
createNxtServoController(LegacyModule legacyModule,
int physicalPort)
Create an instance of an NXT ServoController
|
TouchSensor |
createNxtTouchSensor(LegacyModule legacyModule,
int physicalPort) |
TouchSensorMultiplexer |
createNxtTouchSensorMultiplexer(LegacyModule legacyModule,
int port) |
UltrasonicSensor |
createNxtUltrasonicSensor(LegacyModule legacyModule,
int physicalPort)
Create an instance of an UltrasonicSensor
|
PWMOutput |
createPwmOutputDevice(PWMOutputController controller,
int channel) |
PWMOutput |
createPwmOutputDeviceEx(PWMOutputController controller,
int channel) |
Servo |
createServo(ServoController controller,
int portNumber)
Create an instance of a Servo
|
Servo |
createServoEx(ServoController controller,
int portNumber) |
DcMotorController |
createUsbDcMotorController(SerialNumber serialNumber)
Create an instance of a DcMotorController
|
LegacyModule |
createUsbLegacyModule(SerialNumber serialNumber)
Create an instance of a LegacyModule
|
ServoController |
createUsbServoController(SerialNumber serialNumber)
Create an instance of a ServoController
|
HardwareDevice |
createUserI2cDevice(I2cController controller,
int channel,
UserSensorType type)
Returns a new instance of a user-defined sensor type.
|
java.util.Map<SerialNumber,DeviceManager.DeviceType> |
scanForUsbDevices()
Get a listing of all Modern Robotics devices connected.
|
java.util.Map<SerialNumber,DeviceManager.DeviceType> scanForUsbDevices() throws RobotCoreException
This method will attempt to open all USB devices that are using an FTDI USB chipset. It will then probe the device to determine if it is a Modern Robotics device. Finally, it will close the device.
Because of the opening and closing of devices, it is recommended that this method is not called while any FTDI devices are in use.
RobotCoreException
- if unable to open a deviceDcMotorController createUsbDcMotorController(SerialNumber serialNumber) throws RobotCoreException, java.lang.InterruptedException
serialNumber
- serial number of controllerRobotCoreException
- if unable to create instancejava.lang.InterruptedException
DcMotor createDcMotor(DcMotorController controller, int portNumber)
controller
- DC Motor controller this motor is attached toportNumber
- physical port number on the controllerDcMotor createDcMotorEx(DcMotorController controller, int portNumber)
ServoController createUsbServoController(SerialNumber serialNumber) throws RobotCoreException, java.lang.InterruptedException
serialNumber
- serial number of controllerRobotCoreException
- if unable to create instancejava.lang.InterruptedException
Servo createServo(ServoController controller, int portNumber)
controller
- Servo controller this servo is attached toportNumber
- physical port number on the controllerServo createServoEx(ServoController controller, int portNumber)
CRServo createCRServo(ServoController controller, int portNumber)
LegacyModule createUsbLegacyModule(SerialNumber serialNumber) throws RobotCoreException, java.lang.InterruptedException
serialNumber
- serial number of legacy moduleRobotCoreException
- if unable to create instancejava.lang.InterruptedException
DeviceInterfaceModule createDeviceInterfaceModule(SerialNumber serialNumber) throws RobotCoreException, java.lang.InterruptedException
serialNumber
- serial number of Core Device Interface moduleRobotCoreException
- if unable to create instancejava.lang.InterruptedException
TouchSensor createNxtTouchSensor(LegacyModule legacyModule, int physicalPort)
legacyModule
- the Legacy Module this sensor is attached tophysicalPort
- port number on Legacy Module it's connected toTouchSensorMultiplexer createNxtTouchSensorMultiplexer(LegacyModule legacyModule, int port)
legacyModule
- the Legacy Module this sensor is attached toport
- port number on Legacy Module this sensor is connected to.AnalogInput createAnalogInputDevice(AnalogInputController controller, int channel)
controller
- Analog Input Controller Module this device is connected toAnalogOutput createAnalogOutputDevice(AnalogOutputController controller, int channel)
controller
- Analog Output Controller Module this device is connected toDigitalChannel createDigitalChannelDevice(DigitalChannelController controller, int channel)
controller
- Device Interface Module this device is connected toPWMOutput createPwmOutputDevice(PWMOutputController controller, int channel)
controller
- PWM Output Controller Module this device is connected toPWMOutput createPwmOutputDeviceEx(PWMOutputController controller, int channel)
I2cDevice createI2cDevice(I2cController controller, int channel)
controller
- I2c Controller Module this device is conneced tochannel
- the channel it's connected to on the ControllerHardwareDevice createUserI2cDevice(I2cController controller, int channel, UserSensorType type)
DcMotorController createNxtDcMotorController(LegacyModule legacyModule, int physicalPort)
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toServoController createNxtServoController(LegacyModule legacyModule, int physicalPort)
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toCompassSensor createNxtCompassSensor(LegacyModule legacyModule, int physicalPort)
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toTouchSensor createDigitalTouchSensor(DeviceInterfaceModule deviceInterfaceModule, int physicalPort)
deviceInterfaceModule
- Legacy Module this device is connected tophysicalPort
- port number on the Device Interface Module this device is connected toAccelerationSensor createNxtAccelerationSensor(LegacyModule legacyModule, int physicalPort)
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toLightSensor createNxtLightSensor(LegacyModule legacyModule, int physicalPort)
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toIrSeekerSensor createNxtIrSeekerSensor(LegacyModule legacyModule, int physicalPort)
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toIrSeekerSensor createI2cIrSeekerSensorV3(I2cController i2cController, int physicalPort)
i2cController
- the I2cController
this device is connected tophysicalPort
- port number on the Device Interface Module this device is connected toUltrasonicSensor createNxtUltrasonicSensor(LegacyModule legacyModule, int physicalPort)
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toGyroSensor createNxtGyroSensor(LegacyModule legacyModule, int physicalPort)
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toGyroSensor createModernRoboticsI2cGyroSensor(I2cController i2cController, int physicalPort)
i2cController
- module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toOpticalDistanceSensor createAnalogOpticalDistanceSensor(AnalogInputController analogInputController, int physicalPort)
analogInputController
- controller this sensor is connected tophysicalPort
- the port number on the controller it's plugged intoColorSensor createAdafruitI2cColorSensor(I2cController controller, int channel)
controller
- Device Interface Module this sensor is connected tochannel
- the I2C port on the Device Interface this module is connected toColorSensor createNxtColorSensor(LegacyModule controller, int channel)
controller
- Legacy Module this sensor is attached tochannel
- the I2C port it's connected toColorSensor createModernRoboticsI2cColorSensor(I2cController controller, int channel)
controller
- Device Interface Module this sensor is attached tochannel
- the I2C port it's connected toLED createLED(DigitalChannelController controller, int channel)
controller
- Digital Channel Controller this LED is connected tochannel
- the digital port it's connected to