YAGSL
  • Welcome to Yet Another Swerve Document
    • Resources
  • Overview
    • What we do
    • Our Features
      • Telemetry
      • Simulation
      • Lock Pose
      • Max Speed
      • Chassis Speed Discretization
      • Vision Odometry
      • Heading Correction
      • Auto-centering Modules
      • Offset Offloading
      • Cosine Compensation
      • Module Auto-synchronization
      • Angular Velocity Compensation
    • Changelog
    • Java API
    • Example Code
    • Config Generator
    • 💸Donations
    • 👕Merch
    • Discord
  • Fundamentals
    • Swerve Drive
    • Swerve Modules
  • Bringing up swerve
    • Preface
    • Swerve Information
    • Check your gyroscope
    • Check your motors
    • Creating your first configuration
  • Configuring YAGSL
    • Getting to know your robot
      • Gear Ratio
    • Dependency Installation
    • Configuration
      • Swerve Drive Configuration
      • Physical Properties Configuration
      • PIDF Properties Configuration
        • PIDF
      • Swerve Module Configuration
      • Controller Properties Configuration
      • Device Configuration
    • Code Setup
    • Standard Conversion Factors
    • How to tune PIDF
    • When to invert?
    • Flowcharts
    • The eight steps
    • Swerve Drive Drift
    • SparkMAX Common Problems
    • Verifying your Module Locations
    • Tuning out Drift
  • Devices
    • Gyroscope
      • NavX
      • Pigeon
      • Pigeon 2.0
      • ADXRS450
      • ADIS16448
      • ADIS16470
    • Motor Controllers
      • SparkMAX
      • SparkFlex
      • TalonFX
    • Absolute Encoders
  • Analytics and Debugging
    • FRC Web Components
    • Advantage Scope
  • Product Guides
    • Java API
    • PathPlanner
    • ❌Tuning PID with REV Hardware Client
    • ❌Drive Code
  • Legacy Documentation
Powered by GitBook
On this page
  • Swerve Module Configuration (module/x.json)
  • Fields
  • Example Configuration

Was this helpful?

Edit on GitHub
  1. Configuring YAGSL
  2. Configuration

Swerve Module Configuration

PreviousPIDFNextController Properties Configuration

Last updated 4 months ago

Was this helpful?

Swerve Module Configuration (module/x.json)

The swerve module configuration configures unique properties of each swerve module. It maps 1:1 with which is used to create . This configuration file interacts directly with swerve kinematics.

IF your angle motors spin out of control then you may need to invert them in inverted

IF your drive motors spin uncontrollably you may have the drive motor set to be the angle motor via the ID's. Be sure to check them!

Fields

Name
Units
Required
Description

drive

Y

Drive motor device configuration.

angle

Y

Angle motor device configuration.

encoder

Y

Absolute encoder device configuration.

inverted

Y

Inversion state of each motor as a boolean.

absoluteEncoderOffset

Degrees

Y

Absolute encoder offset from 0 in degrees. May need to be a negative number.

absoluteEncoderInverted

Bool

N

Inversion state of the Absolute Encoder.

location

Y

The location of the swerve module from the center of the robot in inches. +x is torwards the robot front, and +y is torwards robot left.

conversionFactors

N

useCosineCompensator

Bool

N

Disabled cosine compensation which scales the velocity of modules which are not completely aligned with desired angles by the cosine of the difference between the angles.

MotorConfig

Name
Units
Required
Description

drive

Value

Y

Drive motor value.

angle

Value

Y

Angle motor value.

Location

Name
Units
Required
Description

front

Value

Y

Inches from robot center to module in forward direction.

left

Value

Y

Inches from robot center to module in left direction.

Example Configuration

{
  "drive": {
    ,
    "id": 2,
    "canbus": null
  },
  "angle": {
    ,
    "id": 1,
    "canbus": null
  },
  "encoder": {
    ,
    "id": 10,
    "canbus": null
  },
  "inverted": {
    "drive": false,
    "angle": false
  },
  "absoluteEncoderInverted": false,
  "absoluteEncoderOffset": -50.977,
  "location": {
    "front": 12,
    "left": -12
  }
}

Overrides the value in if present and not equal to 0.

OVERRIDE Conversion factors applied to the motor controller for the onboard PID, used to override this setting in

ModuleJson
SwerveModuleConfiguration
swervedrive.json
MotorConfig
Location
Conversion Factor Composition
physicalproperties.json
Motor Controller
Motor Controller
Absolute Encoder