Skip to content

Device Configuration

T Grinch edited this page Aug 30, 2023 · 16 revisions

Device Configuration

All devices in a swerve drive come down to a basic set of fields. The device configuration is used to store and create those devices during parsing with a 1:1 mapping to DeviceJson.java.

Fields

Name Units Required Description
type integrated, attached (When running the encoder off of the dataport of a SparkMax), analog, thrifty, throughbore, analog, dutycycle, cancoder, none, canandcoder, canandcoder_can for Encoders.

navx, navx_usb, navx_onboard, navx_spi, navx_i2c, pigeon, pigeon2, analog, adxrs450, adis16470, adis16448 for IMU's.

sparkmax_brushed, sparkmax, neo, falcon, talonfx, talonsrx for motors.
Y The device type which is used for creation of the Swerve type.
id Integer Y The ID of the device on the CANBus, or the pin ID on the roboRIO for certain devices.
canbus String N The canbus to instantiate the device on. Only works on devices compatible with alternate CAN buses.

When the type is sparkmax_brushed this defines the encoder attached to the motor which is required for drive motors, angle motors should also use them if there is no attached absolute encoder. The valid values in this case are greyhill_63r256, srx_mag_encoder, throughbore, throughbore_dataport, greyhill_63r256_dataport, srx_mag_encoder_dataport.
DO NOT SET THIS IF THE ATTACHED ENCODER IS AN ABSOLUTE ENCODER