Canandgyro
Message/wire format spec, version 2024-offseason.
The device spec for Redux products will not change in a backwards-incompatible fashion in-season, from the first official release for a given year until after the FIRST Championship.
General properties
Section titled “General properties”| Property | Value |
|---|---|
| FRC CAN Device Type | 0x4 |
| DBC File | Link |
| Inherits from | [CanandDevice] |
The DBC files assumes a device id of 0. For more information on the CAN device type, see CanandDevice
Messages
Section titled “Messages”Message summary:
| API Index | Message | Description |
|---|---|---|
| 0x1f | YAW_OUTPUT | Yaw angle frame |
| 0x1e | ANGULAR_POSITION_OUTPUT | Angular position quaternion frame |
| 0x1d | ANGULAR_VELOCITY_OUTPUT | Angular velocity frame |
| 0x1c | ACCELERATION_OUTPUT | Acceleration frame |
| 0x1b | CALIBRATE | Trigger Calibration |
| 0x1a | CALIBRATION_STATUS | Calibration Status |
| 0xb | ENUMERATE | Device enumerate response |
| 0x7 | PARTY_MODE | Party mode |
| 0x6 | STATUS | Status frame |
| 0x5 | CLEAR_STICKY_FAULTS | Clear device sticky faults |
| 0x4 | REPORT_SETTING | Setting value report from device |
| 0x3 | SET_SETTING | Update setting on device |
| 0x2 | SETTING_COMMAND | Setting control command |
YAW_OUTPUT
Section titled “YAW_OUTPUT”Periodic frame with the Canandgyro’s yaw value at full 32-bit float precision in radians.
Properties
| Property | Value |
|---|---|
| API Index | 0x1f |
| Message length | 6 bytes |
| Transmission direction | Device -> robot |
| Frame period setting | YAW_FRAME_PERIOD |
| Default frame period | 10 milliseconds |
Signals
| Signal name | Signal type | Optional | Description |
|---|---|---|---|
yaw | yaw | ❌ | Yaw value |
ANGULAR_POSITION_OUTPUT
Section titled “ANGULAR_POSITION_OUTPUT”Periodic frame with an angular position quaternion. The quaternion is normalized and all values are scaled between -1.0 to 1.0 inclusive.
Properties
| Property | Value |
|---|---|
| API Index | 0x1e |
| Message length | 8 bytes |
| Transmission direction | Device -> robot |
Signals
| Signal name | Signal type | Optional | Description |
|---|---|---|---|
w | quat16 | ❌ | Quaternion w term |
x | quat16 | ❌ | Quaternion x term |
y | quat16 | ❌ | Quaternion y term |
z | quat16 | ❌ | Quaternion z term |
CALIBRATE
Section titled “CALIBRATE”Manually triggers gyro calibration. This takes about 5 seconds.
Properties
| Property | Value |
|---|---|
| API Index | 0x1b |
| Message length | 8 bytes |
| Transmission direction | Robot -> device |
Signals
| Signal name | Signal type | Optional | Description |
|---|---|---|---|
calibration_type | CALIBRATION_TYPE | ❌ | Calibration type |
reserved | pad56_t | ❌ | Reserved |
Settings
Section titled “Settings”SET_YAW
Section titled “SET_YAW”Updates the yaw (Z-axis) rotation with the new sent angular position.
$$ \left[\cos\left(\frac{1}{2}(\phi_n - \phi)\right) + \sin\left(\frac{1}{2}(\phi_n - \phi)\right)\hat{\mathbf{k}}\right] \cdot \left(w + x \hat{\mathbf{i}} + y\hat{\mathbf{j}} + z\hat{\mathbf{k}}\right) $$
| Property | Value |
|---|---|
| Setting index | 0xfb |
| Type | yaw |
| Default value | n/a |
| Readable | ❌ |
| Writable | ✅ |
| Resets on factory default | ❌ |
GYRO_ZRO_OFFSET_TEMPERATURE
Section titled “GYRO_ZRO_OFFSET_TEMPERATURE”Saved temperature associated with the saved x/y/z-axis zero-motion angular velocity offset.
| Property | Value |
|---|---|
| Setting index | 0xf2 |
| Type | rfloat32 |
| Default value | 25 |
| Readable | ✅ |
| Writable | ✅ |
| Resets on factory default | ❌ |
Yaw frame data. The absolute (single-turn) yaw is broadcast in radians between -pi inclusive and pi exclusive. Multiturn yaw can be computed by taking $\text{yaw} + \text{wraparound} * 2\pi$.
| Name | Type | Default value | Description |
|---|---|---|---|
yaw | float32_t | 0.0 | Yaw angle |
wraparound | int16_t | 0 | Wraparound counter |
faults
Section titled “faults”| Flag index | Flag name | Default value | Description |
|---|---|---|---|
| 0 | power_cycle | 0 | Device first boots. |
| 1 | can_id_conflict | 0 | CAN id conflict. |
| 2 | can_general_error | 0 | CAN general error. |
| 3 | out_of_temperature_range | 0 | Out of temperature range (0-70°C). |
| 4 | hardware_fault | 0 | Hardware fault. |
| 5 | calibrating | 0 | Device is currently calibrating. |
| 6 | angular_velocity_saturation | 0 | Saturation of angular velocity. |
| 7 | acceleration_saturation | 0 | Saturation of acceleration. |
CALIBRATION_TYPE
Section titled “CALIBRATION_TYPE”| Enum index | Variant name | Description |
|---|---|---|
| 0x0 | NORMAL | Normal calibration routine |
| 0x1 | SAVE_ZRO | Save ZRO at calibration complete |
| 0x2 | TEMP_CAL_0 | Temperature calibrate slot 0 |
| 0x3 | TEMP_CAL_1 | Temperature calibrate slot 1 |