blob: 4d0a9c1e23865354d7614618cafeb198d565e4d9 [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,
18}
19
20table RejectionCount {
21 error:RejectionReason (id: 0);
22 count:uint (id: 1);
23}
24
25table CumulativeStatistics {
26 total_accepted:int (id: 0);
27 total_candidates:int (id: 1);
28 rejection_reasons:[RejectionCount] (id: 2);
29}
30
31table ImuStatus {
32 // Whether the IMU is zeroed or not.
33 zeroed:bool (id: 0);
34 // Whether the IMU zeroing is faulted or not.
35 faulted_zero:bool (id: 1);
36 zeroing:frc971.control_loops.drivetrain.ImuZeroerState (id: 2);
37 // Offset between the pico clock and the pi clock, such that
38 // pico_timestamp + pico_offset_ns = pi_timestamp
39 pico_offset_ns:int64 (id: 3);
40 // Error in the offset, if we assume that the pi/pico clocks are identical and
41 // that there is a perfectly consistent latency between the two. Will be zero
42 // for the very first cycle, and then referenced off of the initial offset
43 // thereafter. If greater than zero, implies that the pico is "behind",
44 // whether due to unusually large latency or due to clock drift.
45 pico_offset_error_ns:int64 (id: 4);
46 left_encoder:double (id: 5);
47 right_encoder:double (id: 6);
48 imu_failures:frc971.controls.ImuFailures (id: 7);
49}
50
51table Status {
52 state: frc971.control_loops.drivetrain.LocalizerState (id: 0);
53 down_estimator:frc971.control_loops.drivetrain.DownEstimatorState (id: 1);
54 imu:ImuStatus (id: 2);
55 // Statistics are per-camera, by camera index.
56 statistics:[CumulativeStatistics] (id: 3);
57}
58
59root_type Status;