SparkMax Motor Controller Introduction#

SparkMax

SparkMax motor controller is produced by REVRobotics, it can use on both brushed and brushless motors.

Software API: REVLib

Motor Definition#

Note

Every configurations is not required, you can config all the settings you need (It will use the default or previous settings if not set)

Attention

VendorDeps: REVLib

public SparkMax motor; //Motor itself
public SparkMaxConfig config; //motor config
public RelativeEncoder encoder; //built in encoder

pubic void configMotor(){
    motor = new SparkMax(0, MotorType.kBrushless);//you can configure the motor type bewteen kBrushless and kBrushed
    config = new SparkMaxConfig();

    config
        .idleMode(IdleMode.kBrake) //The motor mode, kBrake will stop motor immediately otherwise will spin untill stop naturally
        .inverted(false) //configure if the motor inverted
        .follow(0); //you can set the motor followed to another motor, usually used in 4 motor KOP chassis

    motor.configure(config, ResetMode.kResetSafeParameters, PersistMode.kPersistParameters); //apply settings to the motor
}

The Differences between kBrake and kCoast#

kBrake

kCoast

Behaviours

stop instantly

spin untill stop naturally

code

IdleMode.kBrake

IdleMode.kCoast

common usage

Most of the time

CANCoder Calibrating

Note

check out the references: Closedloop Contol Configuring SparkMax