REVLib Changelog


Changes to C++ and Java

  • Increases the default timeout to wait for a periodic status from 2*framePeriodMs to 500ms.

    • Reduces possibility of large, inaccurate jumps in data occurring when retrieving from status frames.

    • Reduces amount of "timed out while waiting for periodic status X" errors in driver station.

    • Adds setPeriodicFrameTimeout() to configure the CAN timeout for periodic status frames. See code docs for more information.

  • Improves reliability of RTR CAN frames such as setting parameters and other commands that expect a response from the device.

    • Adds mechanism to retry requests if sending the request or receiving the response failed. The default value for maximum number of retries is 5.

    • Adds setCANMaxRetries() to configure the value for maximum number of retries. See code docs for more information.

  • Fixes undefined behavior when SPARK motor controller information cannot be retrieved during initialization.

Version 2024.2.3

Changes to Java

  • Fixes issue introduced in v2024.2.2 where calling getEncoder() multiple times can cause a fatal exception in certain circumstances.

Changes to C++ and Java

  • Removes dynamic check for SPARK model when calling getEncoder(), causing unnecessary CAN traffic.

  • Moves zero argument CANSparkBase.getEncoder() to CANSparkMax and CANSparkFlex subclasses to determine default encoder values.

Version 2024.2.2

Changes to C++ and Java

  • Fixes issue where configuring the velocity filter for the default relative encoder of a SPARK Flex would not set the correct parameters.

Changes to Java

  • Improves memory allocation performance.

Version 2024.2.1

Changes to C++ and Java

  • Changes behavior of SPARK Flex and MAX initialization errors to throw exceptions rather than terminating the robot program.

  • Fixes issue where initializing a SPARK Flex or MAX in brushed mode while the device is disconnected from the CAN bus causes the robot program to terminate.

  • Fixes issue where initializing a SPARK Flex or MAX in brushed mode causes robot simulation to terminate.

  • Fixes warning about using the wrong class for a SPARK Flex or MAX during robot simulation.

Changes to C++

  • Fixes ambiguous overload error when no parameters are supplied when calling GetAnalogSensor().

  • Fixes ambiguous overload error when no parameters are supplied when calling GetEncoder().

Version 2024.2.0

Official 2024 FRC kickoff release for REVLib, with full support for SPARK Flex. Requires WPILib 2024 and SPARK Flex/SPARK MAX firmware 24.x.x.

Changes to C++, Java, and LabVIEW

  • Throws an error if firmware version is less than 24.0.0

  • Throws an error if the motor type is set to Brushed on a SPARK Flex while a SPARK Flex Dock is not connected

  • Gets main encoder position with enhanced precision

Changes to C++ and Java

  • Sends a warning to the Driver Station if the wrong class is used for the type of SPARK that is connected

  • Adds CanSparkBase class that exposes functionality that is common to both the SPARK MAX and the SPARK Flex

  • Adds CanSparkFlex class that exposes all functionality of the SPARK Flex

    • CanSparkFlex has a getExternalEncoder() method that returns a SparkFlexExternalEncoder instead of a getAlternateEncoder() method that returns a SparkMaxAlternateEncoder.

    • This is because Alternate Encoder Mode is not necessary for SPARK Flex, and has been replaced by the External Encoder Data Port feature:

      • Can be used simultaneously with the internal encoders in NEO class motors

      • Can be used simultaneously with an absolute encoder and limit switches

      • Virtually no RPM limit

      • No special configuration

  • The following items have been deprecated in favor of new equivalents:

    • Instead of CANSparkMaxLowLevel, use CANSparkLowLevel

    • Instead of SparkMaxAbsoluteEncoder, use SparkAbsoluteEncoder

    • Instead of SparkMaxAnalogSensor, use SparkAnalogSensor

    • Instead of SparkMaxLimitSwitch, use SparkLimitSwitch

    • Instead of SparkMaxPIDController, use SparkPIDController

    • Instead of SparkMaxRelativeEncoder, use SparkRelativeEncoder

    • Instead of ExternalFollower.kFollowerSparkMax, use ExternalFollower.kFollowerSpark

      • The ExternalFollower enum can be accessed at CANSparkMax.ExternalFollower, CANSparkFlex.ExternalFollower, or CANSparkBase.ExternalFollower

  • Adds a CANSparkBase.getSparkModel() method that returns a SparkModel enum

Changes to LabVIEW

  • Deprecates old VIs that are prefixed with "Spark MAX" and replaces them with VIs prefixed with "SPARK"

    • Deprecated icons are "grayed out"

    • Help context (documentation) for deprecated VIs point the user to the equivalent new VI

    • New icons say "SPARK" instead of "REV MAX"

  • Adds SPARK Get

  • Fixes SPARK Get Analog Sensor when used with a SPARK Flex

  • Updates SPARK Get I to get I Accum from status 7 instead of status 2

  • Updates "Alternate Encoder" VIs to be "Alternate or External Encoder"

    • Only throw the data port config warnings when the device is a SPARK MAX

Version 2023.1.3

This version of REVLib requires SPARK MAX Firmware v1.6.3. Please update your SPARK MAX through the REV Hardware Client.

  • Improves documentation for the setZeroOffset() and getZeroOffset() methods on Absolute Encoder objects

  • Fixes issue where reading an absolute encoder’s zero offset could return an incorrect value in certain conditions

Version 2023.1.2

This version of REVLib requires SPARK MAX Firmware v1.6.2. Please update your SPARK MAX through the REV Hardware Client.

  • Adds support to configure the hall sensor's velocity measurement

    • C++/Java: Updates SetMeasurementPeriod() and SetAverageDepth() in the SparkMaxRelativeEncoder class to be used when the relative encoder is configured to be of type kHallSensor.

    • LabVIEW: Adds SPARK MAX Configure Hall and SPARK MAX Get Hall Sensor to set and get the hall sensor's measurement period and average depth.

Version 2023.1.1

  • Adds support for WPILib 2023

  • Adds support for using a duty cycle absolute encoder as a feedback device for the SPARK MAX

    • C++/Java: Adds SparkMaxAbsoluteEncoder class

    • LabVIEW: Adds VIs for configuring and getting the values from a duty cycle absolute encoder

  • Adds Position PID Wrapping to allow continuous input for the SPARK MAX PID controller

    • C++/Java: Adds PositionPIDWrapping methods to the SparkMaxPIDController class

    • LabVIEW: Adds VIs for setting and getting the Position PID Wrapping configuration

  • Allows configuring the periodic frame rates for status frames 4-6

Version 2022.1.2

Breaking Changes

  • LabVIEW: The version of NI Package Manager bundled with the FRC LabVIEW offline installer will no longer work when installing the REVLib package. NIPM must be updated to the latest version or installed from the FRC LabVIEW online installer to be able to install this package of REVLib for LabVIEW

Version 2022.0.0

Breaking changes

  • C++/Java: CANError has been renamed to REVLibError.

  • Java: ColorMatch.makeColor() and the ColorShim class have been removed. Use the WPILib Color class instead.

  • C++/Java: Deleted deprecated constructors, methods, and types

    • Replace deprecated constructors with CANSparkMax.getX() functions.

    • Replace CANEncoder.getCPR() with getCountsPerRevolution().

    • Remove all usages of CANDigitalInput.LimitSwitch.

    • Replace CANSparkMax.getAlternateEncoder() with CANSparkMax.getAlternateEncoder(int countsPerRev).

    • Remove all usages of CANSparkMax.setMotorType(). You can only set the motor type in the constructor now.

    • Replace SparkMax with PWMSparkMax, which is built into WPILib.

  • Java: CANSparkMax.get() now returns the velocity setpoint set by set(double speed) rather than the actual velocity, in accordance with the WPILib MotorController API contract.

  • C++/Java: CANPIDController.getSmartMotionAccelStrategy() now returns SparkMaxPIDController.AccelStrategy.

  • C++/Java: Trying to do the following things will now throw an exception:

    • Creating a CANSparkMax object for a device that already has one

    • Specifying an incorrect countsPerRev value for a NEO hall sensor

    • Java: Calling a CANSparkMax.getX() method using different settings than were used previously in the program

    • Java: Trying to use a CANSparkMax (or another object retrieved from it) after close() has been called

    • C++: Calling a CANSparkMax.getX() method more than once for a single device

  • C++/Java: Deprecated classes in favor of renamed versions

    • C++ users will get cannot declare field to be of abstract type errors until they replace their object declarations with ones for the new classes. Java users will be able to continue to use the old classes through the 2022 season.

    • AlternateEncoderType is replaced by SparkMaxAlternateEncoder.Type.

    • CANAnalog is replaced by SparkMaxAnalogSensor.

    • CANDigitalInput is replaced by SparkMaxLimitSwitch.

    • Java: CANEncoder is replaced by RelativeEncoder.

    • C++: CANEncoder is replaced by SparkMaxRelativeEncoderandSparkMaxAlternateEncoder`.

    • CANPIDController is replaced by SparkMaxPIDController.

    • CANSensor is replaced by MotorFeedbackSensor.

    • ControlType is replaced by CANSparkMax.ControlType.

    • EncoderType is replaced by SparkMaxRelativeEncoder.Type.


  • C++/Java: Added the ability to set the rate of periodic frame 3


  • C++/Java: CANSparkMax.getMotorType() no longer uses the Get Parameter API, which means that it is safe to call frequently

  • Java: The CANSparkMax.getX() methods no longer create a new object on every call

Known issues:

  • SparkMaxPIDController.setIAccum() only works while the control mode is active

Last updated