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
  • Getting Started
  • Documentation
  • Tuning PID
  • YAGSL Checklist
  • Communication
  • Module example configuration
  • Example pidfproperties.json
  • Example physicalproperties.json

Was this helpful?

Edit on GitHub
  1. Devices
  2. Motor Controllers

SparkMAX

PreviousMotor ControllersNextSparkFlex

Last updated 11 months ago

Was this helpful?

This page refers to the REV SparkMAX while attached to a BRUSHLESS MOTOR (REV NEOs) further documentation will be added later to discuss using the REV SparkMAX in brushed mode.

Getting Started

import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkLowLevel.MotorType;


new CANSparkMax(, MotorType.kBrushless);

Documentation

The SparkMAX allows you to test the motor controller PID, run the motor at a set percentage, and update the firmware all from the REV Hardware Client. Installation of the REV Hardware client is required to use the SparkMAX for YAGSL.

The SparkMAX must be disconnected from the CAN bus on startup to run via the REV Hardware Client!

Tuning PID

To tune the PID of the SparkMAX you need to open up the REV Hardware Client select the SparkMAX then open the telemetry tab and set it to position control while messing with the parameters in the lefthand pane.

YAGSL Checklist

Communication

The SparkMAX is capable of communicating via PWM this mode is not supported by YAGSL due to the fact sensors are required for both drive and steering/azimuth/angle motors.

Module example configuration

The following example is one for a module configuration file, e.g. frontleft.json, frontright.json, backleft.json, and backright.json.

{
  "drive": {
    "type": ,
    "id": ,
    "canbus": 
  },
  "angle": {
    "type": ,
    "id": ,
    "canbus": 
  },
  "encoder": {
    "type": "cancoder",
    "id": 11,
    "canbus": null
  },
  "inverted": {
    "drive": ,
    "angle": 
  },
  "absoluteEncoderOffset": -18.281,
  "location": {
    "front": -12,
    "left": -12
  }
}

Example pidfproperties.json

{
  "drive": {
    "p": ,
    "i": ,
    "d": ,
    "f": ,
    "iz": 0
  },
  "angle": {
    "p": ,
    "i": ,
    "d": ,
    "f": ,
    "iz": 0
  }
}

Example physicalproperties.json

{
  "conversionFactor": {
    "drive": ,
    "angle": 
  },
  "currentLimit": {
    "drive": ,
    "angle": 
  },
  "rampRate": {
    "drive": ,
    "angle": 
  },
  "wheelGripCoefficientOfFriction": 1.19,
  "optimalVoltage": 12
}

An small example program to create a object is as follows.

CANSparkMax
SPARK MAX Motor ControllerREV Robotics
Product link to the REV SparkMAX
Logo
InstallationREV Hardware Client
REV Hardware Client Installation guide + download
SPARK MAXREV Hardware Client
SparkMAX guide in REV Hardware Client
Telemetry TabREV Hardware Client
Logo
Logo
Logo