blob: 88f02df468e3b6a8ac1a723077d44417c2fd67ec [file] [log] [blame]
James Kuszmaul8d012f82024-01-31 22:49:13 -08001namespace frc971.imu;
2
Maxwell Henderson4f35c832024-02-11 15:40:30 -08003attribute "static_length";
4
James Kuszmaul8d012f82024-01-31 22:49:13 -08005table 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.
21table 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 Henderson4f35c832024-02-11 15:40:30 -080033 chip_states:[ChipState] (id: 6, static_length: 2);
James Kuszmaul8d012f82024-01-31 22:49:13 -080034}
35
36table DualImu {
Maxwell Henderson4f35c832024-02-11 15:40:30 -080037 // Timestamp from the board corresponding to these samples in nanoseconds.
James Kuszmaul8d012f82024-01-31 22:49:13 -080038 // Future changes may lead us to add per-chip timestamps, but for now
39 // we treat them as being sampled at the same time.
Maxwell Henderson4f35c832024-02-11 15:40:30 -080040 kernel_timestamp:uint64 (id: 0);
James Kuszmaul8d012f82024-01-31 22:49:13 -080041 // 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 Henderson4f35c832024-02-11 15:40:30 -080050 // Timestamp from the IMU in microseconds
51 board_timestamp_us:uint32 (id: 5);
James Kuszmaul8d012f82024-01-31 22:49:13 -080052}
53
54root_type DualImu;