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