Package xbot.common.controls.actuators
Class XServo
java.lang.Object
xbot.common.controls.actuators.XServo
- All Implemented Interfaces:
DataFrameRefreshable
,XBaseIO
- Direct Known Subclasses:
MockServo
,ServoWPIAdapter
A servo motor.
This class is abstract because the actual implementation of a servo motor
will depend on the hardware being used. For example, for a real implementation,
we have the ServoWPIAdapter class, and the Mock library has a MockServo class.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
XServo
(int channel, String name, DevicePolice police) Create a new servo motor. -
Method Summary
-
Field Details
-
channel
protected int channel -
name
-
-
Constructor Details
-
XServo
Create a new servo motor.- Parameters:
channel
- The PWM channel that the servo is connected to.name
- The name of the servo for logging.police
- The device police to register the servo with.
-
-
Method Details
-
getChannel
public int getChannel()Get the PWM channel that this servo is connected to.- Specified by:
getChannel
in interfaceXBaseIO
- Returns:
- The PWM channel that this servo is connected to.
-
set
public abstract void set(double value) Set the servo to a specific value.- Parameters:
value
- The value to set the servo to. This should be a value between 0 and 1.
-
get
public abstract double get()Get the current value of the servo.- Returns:
- The current value of the servo, between 0 and 1.
-
refreshDataFrame
public void refreshDataFrame()Description copied from interface:DataFrameRefreshable
Consumes and processes inputs from the device or subsystem.- Specified by:
refreshDataFrame
in interfaceDataFrameRefreshable
-