Skip to content

add control for shooter, intake and indexer - #6

Merged
AndreNijman merged 14 commits into
mainfrom
feature/control-motors
Sep 30, 2026
Merged

AndreNijman merged 14 commits into
mainfrom
feature/control-motors

Conversation

@bobel-lebob

Copy link
Copy Markdown
Contributor

What changed

Refactor control logic to have state machines for each subsystem, which controls the subsystem. Then control the state in Robot.java, allowing for easy keybinding.

See ## Controls for new controls.

Shooter

During init, the shooter spins up to full power.
When controller tries to shoot, it will spin the indexer, bringing balls to the shooter.

Tested on the robot

Yes.
Shooter, intake and indexer working.

Controls

Shoot: Right trigger.
Intake: Left trigger.
Eject: East button.
Stop: West button.

The stop binding called setshooterstate, which does not exist, so the build failed.
Right trigger ran the indexer but stopped the intake, so balls waiting where the intake meets the indexer never got in. Tested on the prototype on 30 Sep: balls now pass the handoff.
A jammed indexer drew 8.4 to 11.2 A at 0 ticks/s on the prototype, and held
that for as long as the trigger was down. While shooting, the indexer's
current and velocity are now sampled every 50 ms; above 7 A and under
150 ticks/s for 0.3 s counts as a jam, and the indexer backs off at -0.6 for
0.2 s before feeding again. After 3 back-offs in one press, the next jam
leaves it off until the trigger is released and pressed again. The intake
pauses while the indexer backs off, so it doesn't pack the jam tighter.

The decision logic is IndexerStallGuard, pure and unit tested against the
measured jam. Telemetry shows the indexer's feed state, current and speed,
and each jam is logged to logcat under the tag BioBuzz.
In RUN_USING_ENCODER the hub turns power 1.0 into a velocity target of 85%
of the motor's rated speed, about 5100 RPM on the 6000 RPM goBILDA motors.
SHOOT now switches the shooter to RUN_WITHOUT_ENCODER so power 1.0 is full
battery voltage; IDLE and EJECT switch back to closed loop as before.

GobildaMotor.setMode clears the cached power on a mode change, since IDLE
and SHOOT both use power 1.0 and the cache would otherwise skip the write.
@AndreNijman
AndreNijman merged commit 636db8f into main Sep 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants