blob: ad2ac72f35dc63b5b9d383b2d995111e6e94a5f2 [file] [log] [blame]
James Kuszmaul313e9ce2024-02-11 17:47:33 -08001include "frc971/control_loops/drivetrain/drivetrain_status.fbs";
2include "frc971/imu_reader/imu_failures.fbs";
3
4namespace y2024.localizer;
5
6attribute "static_length";
7
8enum RejectionReason : uint8 {
9 // For some reason, the image timestamp indicates that the image was taken
10 // in the future.
11 IMAGE_FROM_FUTURE = 0,
12 // The image was too old for the buffer of old state estimates that we
13 // maintain.
14 IMAGE_TOO_OLD = 1,
15 // Message bridge is not yet connected, and so we can't get accurate
16 // time offsets betwee nnodes.
17 MESSAGE_BRIDGE_DISCONNECTED = 2,
18 // The target ID does not exist.
19 NO_SUCH_TARGET = 3,
20 // Pose estimation error was higher than any normal detection.
21 HIGH_POSE_ERROR = 4,
22 // Pose estimate implied a robot yaw far off from our estimate.
23 HIGH_IMPLIED_YAW_ERROR = 5,
24 // Pose estimate had a high distance to target.
25 // We don't trust estimates very far out.
26 HIGH_DISTANCE_TO_TARGET = 6,
27 // The robot was travelling too fast; we don't trust the target.
28 ROBOT_TOO_FAST = 7,
29 // Pose estimation error ratio was higher than any normal detection.
30 HIGH_POSE_ERROR_RATIO = 8,
31}
32
33table RejectionCount {
34 error:RejectionReason (id: 0);
35 count:uint (id: 1);
36}
37
38table CumulativeStatistics {
39 total_accepted:int (id: 0);
40 total_candidates:int (id: 1);
41 rejection_reasons:[RejectionCount] (id: 2, static_length: 9);
42}
43
44table ImuStatus {
45 // Whether the IMU is zeroed or not.
46 zeroed:bool (id: 0);
47 // Whether the IMU zeroing is faulted or not.
48 faulted_zero:bool (id: 1);
49 zeroing:frc971.control_loops.drivetrain.ImuZeroerState (id: 2);
50 // Offset between the IMU board clock and the orin clock, such that
51 // board_timestamp + board_offset_ns = orin_timestamp
52 board_offset_ns:int64 (id: 3);
53 // Error in the offset, if we assume that the orin/board clocks are
54 // identical and that there is a perfectly consistent latency between the
55 // two. Will be zero for the very first cycle, and then referenced off of
56 // the initial offset thereafter. If greater than zero, implies that the
57 // board is "behind", whether due to unusually large latency or due to
58 // clock drift.
59 board_offset_error_ns:int64 (id: 4);
60 left_encoder:double (id: 5);
61 right_encoder:double (id: 6);
62 imu_failures:frc971.controls.ImuFailures (id: 7);
63}
64
65table Status {
66 state: frc971.control_loops.drivetrain.LocalizerState (id: 0);
67 down_estimator:frc971.control_loops.drivetrain.DownEstimatorState (id: 1);
68 imu:ImuStatus (id: 2);
69 // Statistics are per-camera, by camera index.
70 statistics:[CumulativeStatistics] (id: 3);
71}
72
73root_type Status;