Class Intake.Builder
java.lang.Object
org.edu_nation.easy_ftc.mechanism.Mechanism.Builder<Intake.Builder>
org.edu_nation.easy_ftc.mechanism.MotorMechanism.Builder<Intake.Builder>
org.edu_nation.easy_ftc.mechanism.Intake.Builder
- Enclosing class:
Intake
public static class Intake.Builder
extends org.edu_nation.easy_ftc.mechanism.MotorMechanism.Builder<Intake.Builder>
Construct an
Intake object using the builder design pattern
Basic Usage:
Intake intake = new Intake.Builder(this, hardwareMap).build();
Defaults:
- reverse = false
- reverseDevices = {}
- gamepad = null
- encoder = false
- diameter = 0.0
- length = 0.0
- gearing = 0.0
- count = 1
- names = {"intake"}
- behavior = BRAKE
- dir1 = 0.0
- dir2 = 0.0
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder(com.qualcomm.robotcore.eventloop.opmode.LinearOpMode opMode, com.qualcomm.robotcore.hardware.HardwareMap hardwareMap) Builder constructor -
Method Summary
Modifier and TypeMethodDescriptionbehavior(com.qualcomm.robotcore.hardware.DcMotor.ZeroPowerBehavior behavior) Specify the zero-power behavior of the motorsbuild()Build the intakecount(int count) Specify the number of motorsdiameter(double diameter) Specify the diameter for encoder control (distance-based)encoder()Whether to enable encoders (time-based)gamepad(com.qualcomm.robotcore.hardware.Gamepad gamepad) Pass gamepad for teleop controlgearing(double gearing) Specify the gearing of the motors (increases accuracy of distance-based movement)in(double in) Specify the positional limit forINChange the names of the hardware devicesout(double out) Specify the positional limit forOUTreverse()Whether to reverse devicesReverse the specified deviceReverse the specified devicesMethods inherited from class org.edu_nation.easy_ftc.mechanism.MotorMechanism.Builder
deadzone, length, logo, usb
-
Constructor Details
-
Builder
public Builder(com.qualcomm.robotcore.eventloop.opmode.LinearOpMode opMode, com.qualcomm.robotcore.hardware.HardwareMap hardwareMap) Builder constructor- Parameters:
opMode- instance of the calling opModehardwareMap- instance of the calling opMode's hardwareMap- Throws:
NullPointerException- if opMode or hardwareMap are null
-
-
Method Details
-
reverse
Description copied from class:org.edu_nation.easy_ftc.mechanism.Mechanism.BuilderWhether to reverse devices- Overrides:
reversein classorg.edu_nation.easy_ftc.mechanism.Mechanism.Builder<Intake.Builder>- Returns:
- builder instance
-
reverse
Description copied from class:org.edu_nation.easy_ftc.mechanism.Mechanism.BuilderReverse the specified device- Overrides:
reversein classorg.edu_nation.easy_ftc.mechanism.Mechanism.Builder<Intake.Builder>- Parameters:
deviceName- name of the device to be reversed- Returns:
- builder instance
- Throws:
NullPointerException- if deviceName is null
-
reverse
Description copied from class:org.edu_nation.easy_ftc.mechanism.Mechanism.BuilderReverse the specified devices- Overrides:
reversein classorg.edu_nation.easy_ftc.mechanism.Mechanism.Builder<Intake.Builder>- Parameters:
deviceNames- an array of the names of devices to be reversed- Returns:
- builder instance
- Throws:
NullPointerException- if deviceNames is null
-
gamepad
Description copied from class:org.edu_nation.easy_ftc.mechanism.Mechanism.BuilderPass gamepad for teleop control- Overrides:
gamepadin classorg.edu_nation.easy_ftc.mechanism.Mechanism.Builder<Intake.Builder>- Parameters:
gamepad- instance of the gamepad- Returns:
- builder instance
- Throws:
NullPointerException- if gamepad is null
-
encoder
Description copied from class:org.edu_nation.easy_ftc.mechanism.MotorMechanism.BuilderWhether to enable encoders (time-based)- Overrides:
encoderin classorg.edu_nation.easy_ftc.mechanism.MotorMechanism.Builder<Intake.Builder>- Returns:
- builder instance
-
diameter
Description copied from class:org.edu_nation.easy_ftc.mechanism.MotorMechanism.BuilderSpecify the diameter for encoder control (distance-based)- Overrides:
diameterin classorg.edu_nation.easy_ftc.mechanism.MotorMechanism.Builder<Intake.Builder>- Parameters:
diameter- measurement of the wheel or axel attached to the motor- Returns:
- builder instance
- Throws:
IllegalArgumentException- if diameter <= 0
-
gearing
Description copied from class:org.edu_nation.easy_ftc.mechanism.MotorMechanism.BuilderSpecify the gearing of the motors (increases accuracy of distance-based movement)- Overrides:
gearingin classorg.edu_nation.easy_ftc.mechanism.MotorMechanism.Builder<Intake.Builder>- Parameters:
gearing- gearing of the motors in the mechanism- Returns:
- builder instance
- Throws:
IllegalArgumentException- if gearing <= 0
-
count
Specify the number of motors- Parameters:
count- the number of motors in the intake mechanism- Returns:
- builder instance
- Throws:
IllegalArgumentException- if count isn't 1 or 2
-
names
Change the names of the hardware devices- Specified by:
namesin classorg.edu_nation.easy_ftc.mechanism.MotorMechanism.Builder<Intake.Builder>- Parameters:
names- an array of the names for the hardware devices- Returns:
- builder instance
- Throws:
NullPointerException- if names is null
-
behavior
Specify the zero-power behavior of the motors- Parameters:
behavior- the zero-power behavior, one of ZeroPowerBehavior.BRAKE or FLOAT- Returns:
- builder instance
- Throws:
NullPointerException- if behavior is null
-
in
Specify the positional limit forIN- Parameters:
in- positional limit forIN- Returns:
- builder instance
-
out
Specify the positional limit forOUT- Parameters:
out- positional limit forOUT- Returns:
- builder instance
-
build
Build the intake- Returns:
- intake instance
- Throws:
IllegalStateException- if count != names.lengthIllegalStateException- if encoder = false and one of: diameter, length, or gearing has been setIllegalStateException- if dir1 < dir2
-