Package org.firstinspires.ftc.teamcode
Enum API.Servo
- java.lang.Object
-
- java.lang.Enum<API.Servo>
-
- org.firstinspires.ftc.teamcode.API.Servo
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getPosition()
Gets the current position of the servo.void
setDirection(API.Direction direction, boolean immediate)
Sets the direction of the servo.void
setPosition(double degrees)
Sets the intended position of the servo, in degrees.void
start(double power)
Starts the servovoid
stop()
Stops the servo by setting the power to 0.static API.Servo
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static API.Servo[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
S0
public static final API.Servo S0
-
S1
public static final API.Servo S1
-
S2
public static final API.Servo S2
-
S3
public static final API.Servo S3
-
S4
public static final API.Servo S4
-
S5
public static final API.Servo S5
-
S6
public static final API.Servo S6
-
S7
public static final API.Servo S7
-
S8
public static final API.Servo S8
-
S9
public static final API.Servo S9
-
S10
public static final API.Servo S10
-
S11
public static final API.Servo S11
-
-
Method Detail
-
values
public static API.Servo[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (API.Servo c : API.Servo.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static API.Servo valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
setPosition
public void setPosition(double degrees)
Sets the intended position of the servo, in degrees. Note that intended means it will not necessarily get to this position, but that it will constantly attempt to get there.- Parameters:
degrees
- The intended position.
-
getPosition
public double getPosition()
Gets the current position of the servo. Might not match up with setPosition.- Returns:
- The position in degrees.
-
start
public void start(double power)
Starts the servo- Parameters:
power
- The power to use, from 0 to 1
-
stop
public void stop()
Stops the servo by setting the power to 0.
-
setDirection
public void setDirection(API.Direction direction, boolean immediate)
Sets the direction of the servo.- Parameters:
direction
- The direction.immediate
- Whether to start the servo upon setting direction or not.
-
-