public class CRServoImpl extends java.lang.Object implements CRServo
DcMotorSimple.DirectionHardwareDevice.Manufacturer| Modifier and Type | Field and Description |
|---|---|
protected static double |
apiPowerMax |
protected static double |
apiPowerMin |
protected static double |
apiServoPositionMax |
protected static double |
apiServoPositionMin |
protected ServoController |
controller |
protected DcMotorSimple.Direction |
direction |
protected int |
portNumber |
| Constructor and Description |
|---|
CRServoImpl(ServoController controller,
int portNumber)
Constructor
|
CRServoImpl(ServoController controller,
int portNumber,
DcMotorSimple.Direction direction)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this device
|
java.lang.String |
getConnectionInfo()
Get connection information about this device in a human readable format
|
ServoController |
getController()
Returns the underlying servo controller on which this servo is situated.
|
java.lang.String |
getDeviceName()
Returns a string suitable for display to the user as to the type of device.
|
DcMotorSimple.Direction |
getDirection()
Returns the current logical direction in which this motor is set as operating.
|
HardwareDevice.Manufacturer |
getManufacturer()
Returns an indication of the manufacturer of this device.
|
int |
getPortNumber()
Returns the port number on the underlying servo controller on which this motor is situated.
|
double |
getPower()
Returns the current configured power level of the motor.
|
int |
getVersion()
Version
|
void |
resetDeviceConfigurationForOpMode()
Resets the device's configuration to that which is expected at the beginning of an OpMode.
|
void |
setDirection(DcMotorSimple.Direction direction)
Sets the logical direction in which this motor operates.
|
void |
setPower(double power)
Sets the power level of the motor, expressed as a fraction of the maximum
possible power / speed supported according to the run mode in which the
motor is operating.
|
protected ServoController controller
protected int portNumber
protected DcMotorSimple.Direction direction
protected static final double apiPowerMin
protected static final double apiPowerMax
protected static final double apiServoPositionMin
protected static final double apiServoPositionMax
public CRServoImpl(ServoController controller, int portNumber)
controller - Servo controller that this servo is attached toportNumber - physical port number on the servo controllerpublic CRServoImpl(ServoController controller, int portNumber, DcMotorSimple.Direction direction)
controller - Servo controller that this servo is attached toportNumber - physical port number on the servo controllerdirection - FORWARD for normal operation, REVERSE to reverse operationpublic HardwareDevice.Manufacturer getManufacturer()
HardwareDevicegetManufacturer in interface HardwareDevicepublic java.lang.String getDeviceName()
HardwareDevicegetDeviceName in interface HardwareDevicepublic java.lang.String getConnectionInfo()
HardwareDevicegetConnectionInfo in interface HardwareDevicepublic int getVersion()
HardwareDevicegetVersion in interface HardwareDevicepublic void resetDeviceConfigurationForOpMode()
HardwareDeviceresetDeviceConfigurationForOpMode in interface HardwareDevicepublic void close()
HardwareDeviceclose in interface HardwareDevicepublic ServoController getController()
CRServogetController in interface CRServoCRServo.getPortNumber()public int getPortNumber()
CRServogetPortNumber in interface CRServoCRServo.getController()public void setDirection(DcMotorSimple.Direction direction)
DcMotorSimplesetDirection in interface DcMotorSimpledirection - the direction to set for this motorDcMotorSimple.getDirection()public DcMotorSimple.Direction getDirection()
DcMotorSimplegetDirection in interface DcMotorSimpleDcMotorSimple.setDirection(Direction)public void setPower(double power)
DcMotorSimpleSetting a power level of zero will brake the motor
setPower in interface DcMotorSimplepower - the new power level of the motor, a value in the interval [-1.0, 1.0]DcMotorSimple.getPower(),
DcMotor.setMode(DcMotor.RunMode),
DcMotor.setPowerFloat()public double getPower()
DcMotorSimplegetPower in interface DcMotorSimpleDcMotorSimple.setPower(double)