Package com.crossbotics.ftchelper.robot
Class Intake
- All Implemented Interfaces:
Subsystem,Toggleable
A roller that pulls game pieces in (and pushes them out): one motor, or one or more continuous
rotation (CR) servos.
intake = add(Intake.motor("intake")); // Robot.java
intake = add(Intake.crServos("left_intake", "right_intake").reversed("right_intake"));
intake = add(Intake.motor("intake").onAtStart()); // runs from START until stopped
Tunables.Intake: inPower (default 1.0) and outPower (default 0.7).
Suggested buttons: hold G2 RT to run it in, hold G2 LT to push out. With onAtStart():
G2 RT switches it on and off, and holding LT pushes out, then goes back to what it was doing.
Docs: docs/modules/robot.md (section "Intake")
-
Method Summary
Modifier and TypeMethodDescriptionvoidThe part's telemetry line; each module adds its own.static IntakeAn intake on one or more CR servos (they run together).voidEndsreverse().holds(int pieces) How many game pieces it can hold at once (for the simulator; default: a guess of 3).voidin()Runs in untilstop().booleanbooleanTrue while it runs in or out.static IntakeAn intake on one motor.Starts running in at START (in autonomous and TeleOp), until stopped.voidout()voidreverse()Pushes out while a button is held: call it every loop while held, andendReverse()on release.reversed()Reverses the only device (same asreversed(itsName)).These run the other way (for example the right one of two facing servos).voidstop()Stops all motion.voidtoggle()On (in) if stopped, stopped if running.voidupdate()Called once every loop.withCrServos(String... crServoNames) CR servos that run together with the intake motor (for example two side wheels next to a roller).
-
Method Details
-
motor
An intake on one motor. -
crServos
An intake on one or more CR servos (they run together). The Tunables section is the first name's. -
withCrServos
CR servos that run together with the intake motor (for example two side wheels next to a roller). They read the same Tunables section.- Parameters:
crServoNames- their configuration names
-
reversed
These run the other way (for example the right one of two facing servos). -
reversed
Reverses the only device (same asreversed(itsName)). -
holds
How many game pieces it can hold at once (for the simulator; default: a guess of 3).- Parameters:
pieces- e.g. 4
-
onAtStart
Starts running in at START (in autonomous and TeleOp), until stopped. -
in
public void in()Runs in untilstop(). -
out
public void out() -
stop
public void stop()Description copied from interface:SubsystemStops all motion. Called at the end of every OpMode. -
toggle
public void toggle()On (in) if stopped, stopped if running.- Specified by:
togglein interfaceToggleable
-
reverse
public void reverse()Pushes out while a button is held: call it every loop while held, andendReverse()on release. Afterwards it goes back to what it was doing (running in, or stopped). -
endReverse
public void endReverse()Endsreverse(). -
isPushingOut
public boolean isPushingOut() -
isRunning
public boolean isRunning()True while it runs in or out. -
update
public void update()Description copied from interface:SubsystemCalled once every loop. Do the hardware work here. Must be quick: no sleep, no waiting. While update() waits, the whole robot is frozen (no driving, no limits, no STOP). -
addTelemetry
Description copied from class:ModuleThe part's telemetry line; each module adds its own.- Specified by:
addTelemetryin interfaceSubsystem- Overrides:
addTelemetryin classModule<Intake>
-