SparkMAX

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

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

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
}

Last updated