James Kuszmaul | 8d012f8 | 2024-01-31 22:49:13 -0800 | [diff] [blame] | 1 | namespace frc971.imu; |
| 2 | |
Maxwell Henderson | 4f35c83 | 2024-02-11 15:40:30 -0800 | [diff] [blame] | 3 | attribute "static_length"; |
| 4 | |
James Kuszmaul | 8d012f8 | 2024-01-31 22:49:13 -0800 | [diff] [blame] | 5 | table ChipState { |
| 6 | // Counter indicating how many samples have been taken on this IMU. |
| 7 | // Note that because averaging occurs on the microcontroller, this |
| 8 | // number may increment by numbers greater than 1. |
| 9 | // The counter will wrap at max_counter, such that |
| 10 | // counter = "true" count % max_counter |
| 11 | counter:uint64 (id: 0); |
| 12 | max_counter:uint64 (id: 1); |
| 13 | // Currently reported temperature, in degrees Celsius. |
| 14 | temperature:float (id: 2); |
| 15 | // If true, the self test has succeeded. |
| 16 | self_test:bool (id: 3); |
| 17 | } |
| 18 | |
| 19 | // IMU axes will be pre-aligned to be consistent with the board |
| 20 | // axes for any chips that are rotated. |
| 21 | table SingleImu { |
| 22 | // Gyro readings in radians/second. |
| 23 | gyro_x:double (id: 0); |
| 24 | gyro_y:double (id: 1); |
| 25 | gyro_z:double (id: 2); |
| 26 | |
| 27 | // Accelerometer readings in Gs. |
| 28 | accelerometer_x:double (id: 3); |
| 29 | accelerometer_y:double (id: 4); |
| 30 | accelerometer_z:double (id: 5); |
| 31 | |
| 32 | // State for the individual ASIC(s) for this IMU. |
Maxwell Henderson | 4f35c83 | 2024-02-11 15:40:30 -0800 | [diff] [blame] | 33 | chip_states:[ChipState] (id: 6, static_length: 2); |
James Kuszmaul | 8d012f8 | 2024-01-31 22:49:13 -0800 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | table DualImu { |
Maxwell Henderson | 4f35c83 | 2024-02-11 15:40:30 -0800 | [diff] [blame] | 37 | // Timestamp from the board corresponding to these samples in nanoseconds. |
James Kuszmaul | 8d012f8 | 2024-01-31 22:49:13 -0800 | [diff] [blame] | 38 | // Future changes may lead us to add per-chip timestamps, but for now |
| 39 | // we treat them as being sampled at the same time. |
James Kuszmaul | 22248e9 | 2024-02-23 16:46:51 -0800 | [diff] [blame^] | 40 | kernel_timestamp:int64 (id: 0); |
James Kuszmaul | 8d012f8 | 2024-01-31 22:49:13 -0800 | [diff] [blame] | 41 | // Packet counter that should increment by 1 for every incoming packet. |
| 42 | packet_counter:uint64 (id: 1); |
| 43 | // Value at which the packet counter wraps, such that |
| 44 | // packet_counter = "true" count % max_packet_counter. |
| 45 | max_packet_counter:uint64 (id: 2); |
| 46 | // Readings associated with the Murata IMU. Should have two chips. |
| 47 | murata:SingleImu (id: 3); |
| 48 | // Readings associated with the TDK IMU. |
| 49 | tdk:SingleImu (id: 4); |
Maxwell Henderson | 4f35c83 | 2024-02-11 15:40:30 -0800 | [diff] [blame] | 50 | // Timestamp from the IMU in microseconds |
| 51 | board_timestamp_us:uint32 (id: 5); |
James Kuszmaul | 8d012f8 | 2024-01-31 22:49:13 -0800 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | root_type DualImu; |