Device Configuration

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.

Fields

NameUnitsRequiredDescription

type

integrated, attached (When running the encoder off of the dataport of a SparkMax), sparkmax_analog (attached to the analog port of the sparkmax dataport), analog, thrifty, throughbore, analog, dutycycle, cancoder, none, canandcoder, canandcoder_can, ma3, rev_hex, am_mag, ctre_mag for Encoders. navx, navx_usb, navx_spi, navx_i2c, pigeon, pigeon2, analog, adxrs450, adis16470, adis16448 for IMU's. sparkflex,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

Useful tips

  1. Optimize your IMU if it isn't as accurate as you hope, NavX's have this nice guide here

  2. Read the code! If you can't understand something all of the code is documented and easy to read.

Last updated