Skip to content

Turret vision - #146

Closed
heitorsDev wants to merge 25 commits into
Pedro-Pathing:masterfrom
team-unimate:turret-vision
Closed

heitorsDev wants to merge 25 commits into
Pedro-Pathing:masterfrom
team-unimate:turret-vision

Conversation

@heitorsDev

Copy link
Copy Markdown

Before issuing a pull request, please see the contributing page.

bwz-kk and others added 25 commits October 5, 2026 22:06
Add field tracking, AprilTag aim, shooter subsystem, and Sloth setup from chassistest
…ning TeleOp

Phase 1 of the turret: one Taura in continuous mode with its analog feedback
read as an absolute encoder, PIDF + kS + robot-turn feedforward, configurable
soft limits (MIN/MAX_ANGLE_DEG), encoder fault stop, and a Turret Tuning
TeleOp for the encoder and control acceptance tests. Adds JUnit tests for the
turret angle math.
Phase 2 of the turret: HiveCells (cell tag IDs, SDK tag row offsets, UP/DOWN
poses), TurretHistory for latency compensation, CellLocator geometry (camera to
turret frame, row direction and middle from 1-4 tags, UP/DOWN decision), one
CellObservation per cell per Limelight frame, and a Vision Test TeleOp. Removes
code comments from the turret and vision files.
…hot status

Phase 3 of the turret: odometry aim from the turret pivot with shot lead,
vision bias with disagreement gate and decay, up-cell tracking with flip
cooldown, shooter velocity from an InterpLUT, okToShoot status chain (with
SHOOTER_NOT_READY), AimMath unit tests, and a Turret Aim Test TeleOp.
Phase 4 of the turret: PosePersistency, SetTurretSide, ShootWhenReady with a
1.5 s okToShoot wait, a TransferSequence placeholder, and Turret TeleOp with
the spec's loop order and telemetry.
Shooter LUT Tuning TeleOp records (distance, velocity) pairs while the turret
auto-aims, and prints them as SHOOTER_DIST_IN / SHOOTER_VEL lines. Adds
ShotTable with tests and Turret.setShooterOverride.
The Taura is a Servo device driven in continuous mode, so use the team's
TauraServo wrapper: setPosition(0.5 + 0.5 * power) and its calibrated
analog feedback for the raw angle. Removes RAW_RANGE_DEG.
Turret now aims by odometry and, when the cell's tags are seen, at the
middle of the tag row voted by every visible tag; the vision-odometry
difference is kept as a bias that decays when tags are lost. Too close is
decided by vision distance only. Out-of-range targets park at 0.

The target cell follows the field half like TrackCell (y >= CENTER_Y aims
at the FAR cell), replacing HIVE UP/DOWN detection and flip tracking.
With one tag visible the row direction comes from the cell pose heading.

Removes AimMath, the status chain, limp mode, turret feedforward, shot
lead, aim offsets, manual cell selection, and the saved up cell.
TurretHistory owns an ElapsedTime and exposes now() in seconds; Turret
and Limelight both read it, so loop time, vision freshness, and capture
time lookups need no nanosecond conversions or scientific notation.
One DecodeNL-style OpMode for encoder, turret control, vision and
shooter tuning. The shooter runs on its own; gamepad1 A switches AUTO
(table) and TUNING (TUNING_VELOCITY from the dashboard), B turns it off
and on, dpad up records a table point, dpad down clears. Turret angle is
locked from the dashboard with USE_MANUAL_ANGLE / MANUAL_ANGLE_DEG, and
SHOW_TAGS adds per-tag fwd/left/up lines. Removes the shooter override.
TurretServo drives the Taura in angular mode through ServoImplEx with a
500-2500 us PWM range. It keeps Turret's aim, vision bias, shooter and
okToShoot, but has no PIDF and no encoder: the turret angle is estimated
by moving toward the setpoint at TURRET_SPEED_DEG_S.

Servo values live in TurretServoConstants (SERVO_RANGE_DEG, CENTER_POSITION,
PWM range, speed); everything else is shared with TurretConstants.

Adds Turret Servo TeleOp and Tuning Servo TeleOp, plus Taura Range Test to
check the analog scale against the PWM range and measure SERVO_RANGE_DEG
with a protractor.

ShootWhenReady now takes a BooleanSupplier so both turrets can use it.
Turret's pivot, odomAngle and visionAngle helpers are public for reuse.
Turret gets STALL, MANUAL, AIM and IDLE states. The requested state is
set once and the turret switches on its own: AIM waits in IDLE while the
goal is unreachable, and a stuck turret cuts power, goes to IDLE and
returns to the requested state.

Adds the missing ResetPose command and the tuning OpModes, removes the
unused AprilTag drivetrain aim code, moves ShotTable tests to the
shooter package and fixes TurretTest for ticksToAngle.
# Conflicts:
#	TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/intake/Intake.java
#	TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/intake/IntakeConstants.java
- TurretMotor: DcMotor-driven turret using the motor encoder, with its own
  constants, manual angle control and a one-gamepad TeleOp
- Gate subsystem on a Taura servo with OPEN/CLOSED states and commands
- Odometry Drift Test TeleOp drawing pose, trail and drift on the Dashboard field
- Fix IntakeFlower TauraServo lookup (wrap a plain Servo)
- Intake, intake flower, shooter and Pinpoint pod offset updates
- Install Panels (fullpanels 1.0.20), which shows the BIOBUZZ field
- Draw the Odometry Drift Test on the Panels field in Pedro coordinates
- Give TurretMotor its own persisted encoder zero instead of sharing the servo turret's
- Update turret motor ticks per rev, TeleOp start pose and Pinpoint pod offsets
- Flower + Gate Tune TeleOp with intake on/reverse on triggers
- IntakeFlower TUNE state and Gate TUNING state
- TransferSequence: close gate, run intake, open gate
- Turret motor auto tuner and controller feedforward/integral
- BIOBUZZ field image on Dashboard, full solo and park auto
@heitorsDev heitorsDev closed this Nov 21, 2026
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