Check your motors

Physically Label each component with their ID's

There is no easier way to screw up configuring a swerve drive (or any other kind of drive system) than putting the wrong channel number, CAN ID, or even CAN bus (if your device is on a CANivore) for a component whether it is the drive motor, angle motor, absolute encoder, or gyroscope. Some components don't have ID's like NavX's and instead have a few different type's which define the connection method (navx_spi, navx_usb, navx_i2c) these just have to be known beforehand.

I strongly suggest you find the information from the Getting to know your robotsheet before you start configuring your robot.

Motors should spin counter clockwise positive

When you spin your motor while the robot is disabled you will notice Motor[...] Raw Angle Encoder (angle/steering/azimuth relative encoder) and Motor[...] Raw Absolute Encoder (absolute encoder) . Both of these should increase while the motor is spun counter clockwise. For more information see here.

pageWhen to invert?

Conversion Factors and your motors

Conversion factors are applied to your motor convert from native units (usually rotations) to degrees for steering/azimuth/angle motors, and meters for drive motors. Conversion factors are only relevant to motor controllers, except if there is an absolute encoder attached to your motor controller.

The Absolute Encoder Offset

The absolute encoder offset is what allows your swerve module to maintain the wheel orientation between power offs. It is vital to a functioning swerve drive.

  1. Line up all wheels so that the bevels are facing to the left like this.

  1. Deploy your code.

  2. DO NOT ENABLE YOUR ROBOT!

  3. Open shuffleboard.

<figure><img src="../.gitbook/assets/shuffleboard_open_tab.png" alt=""><figcaption><p>Open network tables</p></figcaption></figure>
<figure><img src="../.gitbook/assets/shuffleboard_read_vals.png" alt=""><figcaption></figcaption></figure>
  1. Take note of the Module[...] Raw Absolute Encoder value's and use them for absoluteEncoderOffset in the module JSONs.

Special note to MAXSwerve teams!

When you align using the MAXSwerveModules and find the absoluteEncoderOffset for each module you may need to +/-90 from the absoluteEncoderOffset to correct the module position. The absoluteEncoderInverted must also be true in every module configuration as well.

{
  "drive": {
    "type": "sparkmax",
    "id": 12,
    "canbus": null
  },
  "angle": {
    "type": "sparkmax",
    "id": 11,
    "canbus": null
  },
  "encoder": {
    "type": "attached",
    "id": 0,
    "canbus": null
  },
  "inverted": {
    "drive": false,
    "angle": false
  },
  "absoluteEncoderInverted": true,
  "absoluteEncoderOffset": -90,
  "location": {
    "front": 12,
    "left": -12
  }
}

Last updated