James Kuszmaul | 04a343c | 2023-02-20 16:38:22 -0800 | [diff] [blame] | 1 | include "frc971/control_loops/drivetrain/drivetrain_status.fbs"; |
| 2 | include "frc971/imu_reader/imu_failures.fbs"; |
| 3 | |
| 4 | namespace y2023.localizer; |
| 5 | |
| 6 | enum 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-u | 7a7f666 | 2023-02-26 16:41:29 -0800 | [diff] [blame] | 18 | // Pose estimation error was higher than any normal detection. |
| 19 | HIGH_POSE_ERROR = 4, |
milind-u | b45c6d9 | 2023-03-11 18:56:15 -0800 | [diff] [blame] | 20 | // Pose estimate implied a robot yaw far off from our estimate. |
| 21 | HIGH_IMPLIED_YAW_ERROR = 5, |
James Kuszmaul | 04a343c | 2023-02-20 16:38:22 -0800 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | table RejectionCount { |
| 25 | error:RejectionReason (id: 0); |
| 26 | count:uint (id: 1); |
| 27 | } |
| 28 | |
| 29 | table CumulativeStatistics { |
| 30 | total_accepted:int (id: 0); |
| 31 | total_candidates:int (id: 1); |
| 32 | rejection_reasons:[RejectionCount] (id: 2); |
| 33 | } |
| 34 | |
| 35 | table ImuStatus { |
| 36 | // Whether the IMU is zeroed or not. |
| 37 | zeroed:bool (id: 0); |
| 38 | // Whether the IMU zeroing is faulted or not. |
| 39 | faulted_zero:bool (id: 1); |
| 40 | zeroing:frc971.control_loops.drivetrain.ImuZeroerState (id: 2); |
| 41 | // Offset between the pico clock and the pi clock, such that |
| 42 | // pico_timestamp + pico_offset_ns = pi_timestamp |
| 43 | pico_offset_ns:int64 (id: 3); |
| 44 | // Error in the offset, if we assume that the pi/pico clocks are identical and |
| 45 | // that there is a perfectly consistent latency between the two. Will be zero |
| 46 | // for the very first cycle, and then referenced off of the initial offset |
| 47 | // thereafter. If greater than zero, implies that the pico is "behind", |
| 48 | // whether due to unusually large latency or due to clock drift. |
| 49 | pico_offset_error_ns:int64 (id: 4); |
| 50 | left_encoder:double (id: 5); |
| 51 | right_encoder:double (id: 6); |
| 52 | imu_failures:frc971.controls.ImuFailures (id: 7); |
| 53 | } |
| 54 | |
| 55 | table Status { |
| 56 | state: frc971.control_loops.drivetrain.LocalizerState (id: 0); |
| 57 | down_estimator:frc971.control_loops.drivetrain.DownEstimatorState (id: 1); |
| 58 | imu:ImuStatus (id: 2); |
| 59 | // Statistics are per-camera, by camera index. |
| 60 | statistics:[CumulativeStatistics] (id: 3); |
| 61 | } |
| 62 | |
| 63 | root_type Status; |