Class CameraHeadingCheck
- All Implemented Interfaces:
Check
For each multi-tag frame the caller passes the camera's heading and the gyro's yaw at the same
moment. The difference is the camera's offset from the gyro, which stays constant while the robot
turns, so frames from different moments and cameras can be compared. Each camera's offset is the
median over the last WINDOW_SECONDS. A wrong mount yaw shifts one camera's offset by the
error: TXMAN1 Q30's flipped yaw sign put LL-Left 172 deg from LL-Back, and the pose was seeded
backwards from it.
The check fails when two cameras' offsets differ by more than FAIL_DEG, or once the
pose heading has been seeded, when a camera's offset differs from the fused heading's by that
much. It cannot tell which camera of a disagreeing pair is wrong; it names both. Only multi-tag
frames count: a single tag's heading can flip, and MegaTag2-style solves take the heading from
the robot, so they must not be passed in.
Only a camera the robot fuses can fail the check. One that is only logged (a SystemCore camera with a placeholder mount, an Orin camera switched off) warns at most: its heading cannot move the pose, so it is no reason to call the robot NO-GO.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleAbove this, a heading is wrong enough to send an auto the wrong way, and well above mount error: TXMAN1's LL-Left yaw, 5.5 deg off, read 7-9 deg from LL-Back in matches.static final doubleA worse verdict must last this long before it is reported.static final doubleFaster than this (rad/s), latency between the frame and the gyro reading would add error.static final intFrames a camera needs in the window before it is judged.static final doubleAbove this, a camera's mount yaw is probably off and worth solving again.static final doubleFrames older than this are dropped, so a fixed or re-seeded heading clears soon. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFrame(String camera, boolean cameraFused, double cameraHeadingDeg, double gyroYawDeg, int tagCount, double yawRateRadPerSec, double now) Records one camera frame, saying whether the robot fuses that camera.voidaddFrame(String camera, double cameraHeadingDeg, double gyroYawDeg, int tagCount, double yawRateRadPerSec, double now) Records one camera frame.evaluate(double now) Judges the robot now.voidsetRobotHeading(double fusedHeadingDeg, double gyroYawDeg) The robot's fused heading now, with the gyro's yaw now, so each camera can be compared with the heading the robot will drive by.
-
Field Details
-
FAIL_DEG
public static final double FAIL_DEGAbove this, a heading is wrong enough to send an auto the wrong way, and well above mount error: TXMAN1's LL-Left yaw, 5.5 deg off, read 7-9 deg from LL-Back in matches. Q30's sign error read 172.- See Also:
-
WARN_DEG
public static final double WARN_DEGAbove this, a camera's mount yaw is probably off and worth solving again. Before TXMAN1 Q13 and practice r16, LL-Back and LL-Left read 4.4 and 5.0 deg apart.- See Also:
-
WINDOW_SECONDS
public static final double WINDOW_SECONDSFrames older than this are dropped, so a fixed or re-seeded heading clears soon.- See Also:
-
MIN_FRAMES
public static final int MIN_FRAMESFrames a camera needs in the window before it is judged.- See Also:
-
MAX_YAW_RATE
public static final double MAX_YAW_RATEFaster than this (rad/s), latency between the frame and the gyro reading would add error.- See Also:
-
HOLD_SECONDS
public static final double HOLD_SECONDSA worse verdict must last this long before it is reported. While the windows refill after the heading changes under the cameras (in the simulator, the robot placed without its gyro turning), cameras' medians flip at different moments and briefly disagree; a wrong mount disagrees for good.- See Also:
-
-
Constructor Details
-
CameraHeadingCheck
public CameraHeadingCheck()
-
-
Method Details
-
addFrame
public void addFrame(String camera, double cameraHeadingDeg, double gyroYawDeg, int tagCount, double yawRateRadPerSec, double now) Records one camera frame. Ignored unless it saw two or more tags and the robot was turning slower thanMAX_YAW_RATE.- Parameters:
camera- the camera's namecameraHeadingDeg- the robot heading the camera solvedgyroYawDeg- the gyro's yaw at the frametagCount- tags in the solveyawRateRadPerSec- the robot's turn rate nownow- this loop's robot time
-
addFrame
public void addFrame(String camera, boolean cameraFused, double cameraHeadingDeg, double gyroYawDeg, int tagCount, double yawRateRadPerSec, double now) Records one camera frame, saying whether the robot fuses that camera. Ignored unless it saw two or more tags and the robot was turning slower thanMAX_YAW_RATE.- Parameters:
camera- the camera's namecameraFused- whether any of the camera's sources is fused into the pose nowcameraHeadingDeg- the robot heading the camera solvedgyroYawDeg- the gyro's yaw at the frametagCount- tags in the solveyawRateRadPerSec- the robot's turn rate nownow- this loop's robot time
-
setRobotHeading
public void setRobotHeading(double fusedHeadingDeg, double gyroYawDeg) The robot's fused heading now, with the gyro's yaw now, so each camera can be compared with the heading the robot will drive by. Call every loop; NaN until the heading is seeded.- Parameters:
fusedHeadingDeg- the fused pose's heading, or NaN if not seededgyroYawDeg- the gyro's yaw
-
evaluate
Description copied from interface:CheckJudges the robot now. Called only while disabled, and not every loop:PreMatchChecksspreads the checks across loops.
-