Skip to content

Canandcolor

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.

PropertyValue
FRC CAN Device Type0x6
DBC FileLink
Inherits from[CanandDevice]

The DBC files assumes a device id of 0. For more information on the CAN device type, see CanandDevice

All value fields are default unsigned little-endian unless otherwise specified.

This document uses the following conventions for notating field types:

TypeDescription
boolSingle-bit boolean
float:24IEEE 754 single-precision float with the least significant 8 bits of mantissa stripped to fit in 3 bytes
float:32IEEE 754 single-precision (32-bit) float
float:64IEEE 754 double-precision (64-bit) float
uintN_tUnsigned integer of bit width N
intN_tSigned integer of bit width N
padN_tN bits of padding bits that should be left zero.
uint8_t[N]N bytes of a byte array

Additionally, when literals are specified for default values,

  • true and false are defined as bit values 1 and 0 respectively
  • For a byte array specified as {0x1, 0x2, 0x3, 0x4} the first (index zero) byte is 0x1 and the last is 0x4.

These are the definitions of messages sent over CAN, USB, or other encapsulation mechanisms.

Message summary:

API IndexMessageDescription
0x1fDISTANCE_OUTPUTDistance frame
0x1eCOLOR_OUTPUTColor frame
0x1dDIGITAL_OUTPUTDigital output frame
0x1cCLEAR_STICKY_DIGOUTClear sticky digout state
0xbENUMERATEDevice enumerate response
0x7PARTY_MODEParty mode
0x6STATUSStatus frame
0x5CLEAR_STICKY_FAULTSClear device sticky faults
0x4REPORT_SETTINGSetting value report from device
0x3SET_SETTINGUpdate setting on device
0x2SETTING_COMMANDSetting control command

Periodic frame with the Canandcolor’s raw 16-bit distance output. This distance measurement increases approximately linearly as objects move away from the sensor.

Properties

PropertyValue
API Index0x1f
Message length2 bytes
Transmission directionDevice -> robot
Frame period settingDISTANCE_FRAME_PERIOD
Default frame period20 milliseconds

Signals

Signal nameSignal typeOptionalDescription
distanceuint16_t16-bit distance value.

Periodic frame with the Canandcolor’s color sensor output, with up to 20-bit precision. The red/blue/green channels will be left-shifted such that the largest possible sensable value is always closest to 0xfffff.

Properties

PropertyValue
API Index0x1e
Message length8 bytes
Transmission directionDevice -> robot
Frame period settingCOLOR_FRAME_PERIOD
Default frame period25 milliseconds

Signals

Signal nameSignal typeOptionalDescription
reduint20_tRed reading magnitude
greenuint20_tGreen reading magnitude
blueuint20_tBlue reading magnitude
periodCOLOR_INTEGRATION_PERIODColor integration period

Periodic frame with the Canandcolor’s digital output state. Digout channel slots are always evaluated, even if the physical digital outputs themselves are disabled.

Properties

PropertyValue
API Index0x1d
Message length5 bytes
Transmission directionDevice -> robot
Frame period settingDIGOUT_FRAME_PERIOD
Default frame period100 milliseconds

Signals

Signal nameSignal typeOptionalDescription
digout1_stateboolDigital output state for DIGOUT1
digout2_stateboolDigital output state for DIGOUT2
digout1_stickyboolSticky digital output state for DIGOUT1
digout2_stickyboolSticky digital output state for DIGOUT1
reservedpad4_tReserved
digout1_conddigout_condDIGOUT1 condition slot flags.
digout2_conddigout_condDIGOUT2 condition slot flags.

Clears the sticky digout state for both digout1 and digout2.

Properties

PropertyValue
API Index0x1c
Message length0 bytes
Transmission directionRobot -> device

See CanandDevice ENUMERATE.

Configures party mode to the device.

Properties

PropertyValue
API Index0x7
Minimum message length1 bytes
Maximum message length8 bytes
Transmission directionRobot -> device

Periodic frame containing status information about the device.

Properties

PropertyValue
API Index0x6
Message length8 bytes
Transmission directionDevice -> robot

Signals

Signal nameSignal typeOptionalDescription
faultsfaults8-bit active faults bitfield
sticky_faultsfaults8-bit sticky faults bitfield
temperaturetemperature16-bit signed temperature
reservedpad32_tReserved bits

See CanandDevice CLEAR_STICKY_FAULTS.

See CanandDevice REPORT_SETTING.

See CanandDevice SET_SETTING.

See CanandDevice SETTING_COMMAND.

Setting summary:

Setting indexNameTypeDefault valueReadableWritableResets to factory defaultDescription
0xffDISTANCE_FRAME_PERIODframe_period20Distance frame period (ms)
0xfeCOLOR_FRAME_PERIODframe_period25Color frame period (ms)
0xfdDIGOUT_FRAME_PERIODframe_period100Digout frame period (ms)
0xf7DISTANCE_EXTRA_FRAME_MODEEXTRA_FRAME_MODEEARLY_TRANSMIT_ON_CHANGEDistance extra frame mode
0xf6COLOR_EXTRA_FRAME_MODEEXTRA_FRAME_MODEEARLY_TRANSMIT_ON_CHANGEColor extra frame mode
0xefLAMP_BRIGHTNESSlamp_brightness36000Lamp LED brightness
0xeeCOLOR_INTEGRATION_PERIODCOLOR_INTEGRATION_PERIODPERIOD_25_ms_RESOLUTION_16_bitColor integration period
0xedDISTANCE_INTEGRATION_PERIODDISTANCE_INTEGRATION_PERIODPERIOD_20_msDistance integration period
0xebDIGOUT1_OUTPUT_CONFIGdigout_control_configType defaultDigital output 1 control config
0xeaDIGOUT2_OUTPUT_CONFIGdigout_control_configType defaultDigital output 2 control config
0xe9DIGOUT1_MESSAGE_ON_CHANGEdigout_message_triggerType defaultDigital output 1 send message on change
0xe8DIGOUT2_MESSAGE_ON_CHANGEdigout_message_triggerType defaultDigital output 2 send message on change
0x8DEVICE_TYPEuint16_tn/aDevice-specific type identifier
0x6FIRMWARE_VERSIONfirmware_versionn/aFirmware version
0x5SERIAL_NUMBERuint8_t[6]n/aSerial number
0x4STATUS_FRAME_PERIODstatus_frame_period100Status frame period (ms)
0x0CAN_IDcan_device_id0CAN Device ID

Period between each transmission of DISTANCE_OUTPUT messages.

Period between each transmission of COLOR_OUTPUT messages.

Period between each transmission of DIGITAL_OUTPUT messages.

Sets the LED brightness for the lamp (white) LED.

Sets the integration period for the color sensor.

Sets the integration period for the distance sensor.

Flag indexFlag nameDefault valueDescription
0power_cycle0The power cycle fault flag.
1can_id_conflict0The CAN ID conflict flag.
2can_general_error0The CAN general error flag.
3out_of_temperature_range0The temperature range flag (0-70°C).
4hardware_fault_distance0Hardware fault for distance sensor.
5hardware_fault_color0Hardware fault for color sensor.
6i2c_bus_recovery0The I2C bus recovery flag.

Temperature as reported to/from the device. 1 LSB = 1/256th of a degree Celsius.

Digout slot represents a digital output slot — a component of programmable digital logic updated at 1000 Hz.

NameTypeDefault valueDescription
slot_enabledboolfalseEnable the digout slot
next_slot_actionNEXT_SLOT_ACTIONTERMINATE_CHAINHow the slot interacts with the next
invert_valueboolfalseInvert the slot’s value
opcodeSLOT_OPCODEEQUALSOpcode
immidiate_additiveint21_t0Additive immediate
immidiate_scalingscaling_factor255Scaling immediate
data_source_aDATA_SOURCEZEROLHS data source
data_source_bDATA_SOURCEZERORHS data source
Enum indexVariant nameDescription
0x0DISABLEDDo not emit extra frames
0x1EARLY_TRANSMIT_ON_CHANGETransmits a frame immediately once readings change
Enum indexVariant nameDescription
0x0ZEROAlways reads zero
0x1DISTANCEDistance reading
0x2REDRed reading
0x3GREENGreen reading
0x4BLUEBlue reading
0x5HUEHue reading
0x6SATURATIONSaturation reading
0x7VALUEValue reading

See CanandDevice SETTING_COMMAND. Additional variants for Canandcolor:

Enum indexVariant nameDescription
0xffCLEAR_DIGOUT1Clear all digout1 slots
0xfeCLEAR_DIGOUT2Clear all digout2 slots
0xfdFETCH_DIGOUT1Fetch all digout1 slots
0xfcFETCH_DIGOUT2Fetch all digout2 slots