Class ServoDevice
java.lang.Object
com.cdarobotics.cdalib.devices.Device
com.cdarobotics.cdalib.devices.actuators.ServoDevice
-
Constructor Summary
ConstructorsConstructorDescriptionServoDevice(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String name) Resolves the servo from the hardware map by configured name.ServoDevice(com.qualcomm.robotcore.hardware.Servo servo) Wraps an already-resolved servo. -
Method Summary
Modifier and TypeMethodDescriptiondoublecom.qualcomm.robotcore.hardware.ServogetServo()scaleRange(double min, double max) Constrains the usable range of the servo.setDirection(com.qualcomm.robotcore.hardware.Servo.Direction direction) Sets the servo's direction.setPosition(double position) Sets the position to command on the nextupdate().voidupdate()Flush pending writes to, or refresh cached reads from, the underlying hardware.
-
Constructor Details
-
ServoDevice
public ServoDevice(com.qualcomm.robotcore.hardware.Servo servo) Wraps an already-resolved servo. -
ServoDevice
Resolves the servo from the hardware map by configured name.
-
-
Method Details
-
setPosition
Sets the position to command on the nextupdate(). Range [0.0, 1.0]. -
getPosition
public double getPosition()- Returns:
- the last commanded position (not necessarily yet flushed to hardware).
-
setDirection
Sets the servo's direction. -
scaleRange
Constrains the usable range of the servo. SeeServo.scaleRange(double, double). -
getServo
public com.qualcomm.robotcore.hardware.Servo getServo()- Returns:
- the wrapped SDK servo, for operations not exposed here.
-
update
public void update()Description copied from class:DeviceFlush pending writes to, or refresh cached reads from, the underlying hardware.
-