Auto Aim Starter
Auto aim in Decode is centered in ArtifactControl. The safest way to adopt it is to build in layers: geometry first, then turret/flywheel, then burst automation.
Step 1
Verify Manual Shooter First
Before auto aim, ensure manual turret and flywheel controls work correctly.
Calibrate servo centers and bounds for LeftTurret, RightTurret, AngleTurret.
Step 2
Enable Distance-Based Models
Decode uses polynomial models and clamp limits:
angleTurretPosition = (0.0000207725 * (basketDistance * basketDistance))
- (0.00755001 * basketDistance)
+ 0.865169;
angleTurretPosition = clamp(angleTurretPosition, 0.25, 0.75);
flyWheelPower = ((-3.15936e-7) * d * d * d)
+ (0.000074273 * d * d)
- (0.00230794 * d)
+ 0.606381;
flyWheelPower = clamp(flyWheelPower, 0.6, 0.87);
Step 3
Protect Servos With Deadzones
Use horizontal and vertical deadzones to prevent jitter and wear.
Only update servos when delta is meaningful.
Step 4
Add Safety Gates for Launch
Use area checks (example: areaOfThrowing()).
Require stationary or controlled state for auto-shoot actions.
Keep immediate manual override on controller.
Auto aim without strong safety gates is risky in scrimmage and match conditions.
Step 5
Integrate With Burst Logic
Connect aim output to burst sequence only after individual subsystems are stable.
Validate with repeated cycle tests, not only single-shot tests.
Modes
IMU only: most deterministic fallback.
Webcam only: useful for vision experiments and corrections.
IMU + Webcam fusion: preferred when both sources are reliable.
Next
Continue with IMU Only implementation first, then compare against webcam-based modes.