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