Class Indexer
Launcher, which decides when to feed:
launcher = add(Launcher.flywheel("launcher", "gobilda-5203-6000").feeder(Indexer.servo("indexer")));
public static class Indexer { // Tunables.java
public static double rest = 0.15, push = 0.55; // servo positions (Indexer.servo)
public static double pushSec = 0.25, returnSec = 0.25;
}
Two arms that push together (one on each side, pinching behind the piece):
Indexer.servo("feeder_left").alsoServoReversed("feeder_right"). They share one Tunables section (the first
name's): the second arm mirrors the first; alsoTrim lines it up.
Two wheels that spin together (one on each side of the piece, squeezing it in):
Indexer.crServo("feeder_left").alsoServoReversed("feeder_right"). Both CR servos get the same power;
the second spins the other way. They share one Tunables section (the first name's).
Tunables: Indexer.servo: rest, push, pushSec, returnSec (and
alsoTrim with a second servo).
Indexer.crServo and Indexer.motor: power and feedSec (how long it
runs per piece), and stopOnShot (true: a launcher's feed stops when the flywheel sees the shot,
and feedSec is the time limit). Added on its own (no launcher), its usual button (a line in Controls.java) is operator RB: feed one.
A feed wheel (Launcher.feedWheel(Indexer.crServo("feeder_wheel"))): a CR servo or motor that
moves the pieces up to the pusher (the launcher's feeder). Its Tunables: power,
alwaysOn (false: it runs only while firing), stageSec (it runs this long before the
push, 0.2) and stopSec (it stops this long after the push starts, 0.3; below 0 = before the push).
Docs: docs/reference/robot-java.md (section "Indexer")
-
Method Summary
Modifier and TypeMethodDescriptionvoidThe part's telemetry line; each module adds its own.voidadjustPush(int steps) A push servo: moves the push position bystepsxTunables pushStep(0.01): + = further from rest (a longer push), - = nearer rest.LikealsoServoReversed(java.lang.String), for a second servo that turns the same way as the first.alsoServoReversed(String name) A second push servo that moves with this one, mirrored: two arms, one on each side, that pinch together behind the piece and push it in.voidclearJam()Forgets a jam (the launcher calls it when the driver asks to shoot again).static IndexerA continuous-rotation servo that runs for a moment per piece.voidfeedOne()Feeds one piece now (ignored while busy).A servo indexer uses its servo's whole turn: positions 0 to 1 send the servo's full pulse range (the part's, else 500-2500 us) instead of the FTC SDK's normal 600-2400 us.booleanisBusy()True until the piece is through and the feeder is ready for the next one.booleanTrue from the start of a feed until it ends (normally, jammed or stopped).booleanisJammed()True if the feeder is jammed (then the launcher stops shooting).booleanTrue ifreversed()is set in Robot.java (positions 0 and 1 swap ends).booleanisServo()True for a servo that pushes and comes back (not a CR servo or motor that runs).static IndexerA motor (a roller or belt) that runs for a moment per piece.voidRunslistenereach time a feed starts (a call while busy is not a feed).doublepushNow()The push position in use now: Tunables push plus theadjustPush(int)trim.reversed()It turns the other way.booleanTrue if the second servo mirrors the first (alsoServoReversed).The second servo's configuration name (alsoServo...), or null if it has one servo.static IndexerA servo that pushes a piece in, then comes back.voidstop()Stops all motion.voidupdate()Called once every loop.Methods inherited from class com.crossbotics.ftchelper.robot.Module
deviceName, isOptional, isPresent, looks, name, optional, part, partId, tunables, zone, zoneAbove, zoneBelow
-
Method Details
-
servo
A servo that pushes a piece in, then comes back. -
fullRange
A servo indexer uses its servo's whole turn: positions 0 to 1 send the servo's full pulse range (the part's, else 500-2500 us) instead of the FTC SDK's normal 600-2400 us. Setrestandpushagain after turning it on: the same position points somewhere else.- Returns:
- this indexer
- Throws:
IllegalStateException- on a CR servo or motor indexer
-
crServo
A continuous-rotation servo that runs for a moment per piece. -
motor
A motor (a roller or belt) that runs for a moment per piece. -
reversed
It turns the other way. -
feedOne
public void feedOne()Feeds one piece now (ignored while busy). A launcher usually calls this, when it is ready. -
onFeed
Runslistenereach time a feed starts (a call while busy is not a feed). A feed that starts may still jam:Piecescounts a piece out only when the feed ends normally (or its ready sensor sees the piece leave). -
isFeeding
public boolean isFeeding()True from the start of a feed until it ends (normally, jammed or stopped). -
isBusy
public boolean isBusy()Description copied from interface:FeederTrue until the piece is through and the feeder is ready for the next one. -
isJammed
public boolean isJammed()Description copied from interface:FeederTrue if the feeder is jammed (then the launcher stops shooting). Default: never. "default" means a class that does not write this method gets this version. -
clearJam
public void clearJam()Description copied from interface:FeederForgets a jam (the launcher calls it when the driver asks to shoot again). Default: nothing. -
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). -
stop
public void stop()Description copied from interface:SubsystemStops all motion. Called at the end of every OpMode. -
addTelemetry
Description copied from class:ModuleThe part's telemetry line; each module adds its own.- Specified by:
addTelemetryin interfaceSubsystem- Overrides:
addTelemetryin classModule<Indexer>
-
adjustPush
public void adjustPush(int steps) A push servo: moves the push position bystepsxTunables pushStep(0.01): + = further from rest (a longer push), - = nearer rest. For a D-pad during TeleOp, when the push stops getting the piece all the way (a servo horn that slips, a worn pad):g1.dpadRight.press(() -> robot.launcher.feeder().adjustPush(+1)). Kept until the program ends; the Tunables value is not changed (the screen shows the number to copy into Tunables). Never past rest, never outside 0 to 1. Ignored for a CR servo or motor feeder. -
pushNow
public double pushNow()The push position in use now: Tunables push plus theadjustPush(int)trim. -
alsoServoReversed
A second push servo that moves with this one, mirrored: two arms, one on each side, that pinch together behind the piece and push it in. Both go to the samerestandpush; the second turns the other way (it is mounted facing the first). If the two do not quite meet, setalsoTrim(raw position added for the second one).On a CR servo indexer: a second wheel that spins with the first, the other way. Two wheels, one on each side of the piece, that squeeze it and move it in (both servos' shafts up, so they must turn opposite ways). Both get the same
power; there is noalsoTrim..feeder(Indexer.servo("feeder_left").alsoServoReversed("feeder_right").part("gobilda-2000-torque")) .feeder(Indexer.crServo("feeder_left").alsoServoReversed("feeder_right").part("gobilda-2000-speed"))- Parameters:
name- the second servo's configuration name- Returns:
- this indexer
- Throws:
IllegalStateException- on a motor indexer
-
alsoServo
LikealsoServoReversed(java.lang.String), for a second servo that turns the same way as the first. For two CR servo wheels: one mounted upside down (shaft down) already spins the other way, so it takes the same power.- Parameters:
name- the second servo's configuration name- Returns:
- this indexer
- Throws:
IllegalStateException- on a motor indexer
-
secondServoName
The second servo's configuration name (alsoServo...), or null if it has one servo. -
isReversed
public boolean isReversed()True ifreversed()is set in Robot.java (positions 0 and 1 swap ends). -
secondServoMirrored
public boolean secondServoMirrored()True if the second servo mirrors the first (alsoServoReversed). -
isServo
public boolean isServo()True for a servo that pushes and comes back (not a CR servo or motor that runs).
-