James Kuszmaul | ef35d73 | 2022-02-12 16:37:32 -0800 | [diff] [blame] | 1 | namespace frc971.controls; |
| 2 | |
| 3 | // This provides a minimal output from the localizer that can be forwarded to |
| 4 | // the roborio and used for corrections to its (simpler) localizer. |
| 5 | |
James Kuszmaul | 10d3fd4 | 2022-02-25 21:57:36 -0800 | [diff] [blame] | 6 | struct Quaternion { |
| 7 | w:double (id: 0); |
| 8 | x:double (id: 1); |
| 9 | y:double (id: 2); |
| 10 | z:double (id: 3); |
| 11 | } |
| 12 | |
Milind Upadhyay | d67e9cf | 2022-03-13 13:56:57 -0700 | [diff] [blame] | 13 | // Used to tell different LEDs to be on or off |
| 14 | enum LedOutput : byte { |
| 15 | ON, |
| 16 | OFF |
| 17 | } |
| 18 | |
James Kuszmaul | ef35d73 | 2022-02-12 16:37:32 -0800 | [diff] [blame] | 19 | table LocalizerOutput { |
| 20 | // Timestamp (on the source node) that this sample corresponds with. This |
| 21 | // may be older than the sent time to account for delays in sensor readings. |
| 22 | monotonic_timestamp_ns:int64 (id: 0); |
| 23 | // Current x/y position estimate, in meters. |
| 24 | x:double (id: 1); |
| 25 | y:double (id: 2); |
| 26 | // Current heading, in radians. |
| 27 | theta:double (id: 3); |
James Kuszmaul | 10d3fd4 | 2022-02-25 21:57:36 -0800 | [diff] [blame] | 28 | // Current estimate of the robot's 3-D rotation. |
| 29 | orientation:Quaternion (id: 4); |
James Kuszmaul | f3ef9e1 | 2022-03-05 17:13:00 -0800 | [diff] [blame] | 30 | // Whether we have zeroed the IMU (may go false if we observe a fault with the |
| 31 | // IMU). |
| 32 | zeroed:bool (id: 5); |
Milind Upadhyay | d67e9cf | 2022-03-13 13:56:57 -0700 | [diff] [blame] | 33 | |
| 34 | // Whether each led should be on. |
| 35 | // Indices correspond to pi number. |
| 36 | led_outputs:[LedOutput] (id: 6); |
Austin Schuh | 3806ffb | 2022-04-13 19:44:10 -0700 | [diff] [blame] | 37 | |
| 38 | // Cumulative number of accepted images. |
| 39 | image_accepted_count:uint (id: 7); |
James Kuszmaul | ef35d73 | 2022-02-12 16:37:32 -0800 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | root_type LocalizerOutput; |