Quickstart · minimum viable run

Detector in, frame in,
command out.

Smallest possible pipeline: load YOLO11n + keypoints weights, feed one frame, get PnP gate pose, emit a PID command. For deeper integration see getting-started. For the full race stack see race-pipeline.

Input
Single BGR frame · telemetry dict
per call
Output
Throttle · Roll · Pitch · Yaw
floats [-1, 1]
Weights
APEX Phase 1 + Phase 2
models/apex_*
Latency
~10 ms · RTX 5080
end-to-end

§ 01Single-file example

from vq1_completion_pilot import (
    ApexDetectorChain, CompletionPilot, CameraIntrinsics, Telemetry
)
from pathlib import Path

intr = CameraIntrinsics(width=640, height=360, fx=320, fy=320, cx=320, cy=180,
                        tilt_deg=20.0, gate_width_m=1.5, gate_height_m=1.5)
detector = ApexDetectorChain(
    detector_path=Path("models/apex_detector_best.onnx"),
    keypoints_path=Path("models/apex_keypoints_best.onnx"),
)
pilot = CompletionPilot(intr=intr, detector=detector)

# ------- one frame, one command -------
frame_bgr = cv2.imread("test_frame.png")
tele = Telemetry(
    attitude_q=(1.0, 0.0, 0.0, 0.0),
    body_rates=(0.0, 0.0, 0.0),
    body_accel=(0.0, 0.0, 9.81),
    t_sim=0.0,
)
cmd = pilot.step(frame_bgr, tele)
print(cmd)   # ControlCmd(throttle=0.55, roll=0.0, pitch=0.01, yaw=-0.04)

§ 02What each line does

§ 03Swapping in the real sim

Replace StubSimClient in vq1_completion_pilot.py with the real AIGP sim adapter when credentials are released:

class AIGPSimClient:
    def connect(self) -> None: ...
    def next_frame(self) -> tuple[np.ndarray, Telemetry]: ...
    def send(self, cmd: ControlCmd) -> None: ...
    def close(self) -> None: ...

The rest of the pipeline is transport-agnostic.

§ 04Troubleshooting

SymptomCauseFix
Detector returns None for all framesWeights not loaded (stub active)Pass real --detector / --keypoints paths
PnP raisesKeypoints not 4×2 floatCheck det.corners_px.shape == (4, 2)
Pilot output saturated at ±1PID gains too hotSee tuning reference
Telemetry attitude wrongSim payload Euler vs quaternionAdapter in CompletionPilot, convert to quat
QUICKSTART · v2.0 2026-04-21 · ← Index · Getting Started