Skip to content
This repository was archived by the owner on Dec 24, 2025. It is now read-only.
This repository was archived by the owner on Dec 24, 2025. It is now read-only.

No support for attached absolute encoder on SparkFlex motor controller #16

@q314tracy

Description

@q314tracy

No support for an absolute encoder connected over the SparkFlex motor controller data port. The "Absolute Encoders" page in the docs does not specifically call out a specific differentiation between a CANSparkMax and a SparkFlex. Attached is the stacktrace when attempting construction with the encoder type in the module configs set as "attached".

********** Robot program starting **********
NT: Listening on NT3 port 1735, NT4 port 5810
Error at swervelib.encoders.SparkMaxEncoderSwerve.<init>(SparkMaxEncoderSwerve.java:63): Unhandled exception instantiating robot swervelib.encoders.SparkMaxEncoderSwerve java.lang.RuntimeException: Motor given to instantiate SparkMaxEncoder is not a CANSparkMax
        at swervelib.encoders.SparkMaxEncoderSwerve.<init>(SparkMaxEncoderSwerve.java:63)
        at swervelib.parser.json.DeviceJson.createEncoder(DeviceJson.java:82)
        at swervelib.parser.json.ModuleJson.createModuleConfiguration(ModuleJson.java:76)
        at swervelib.parser.SwerveParser.createSwerveDrive(SwerveParser.java:185)
        at frc.robot.subsystems.SwerveDriveYAGSL.<init>(SwerveDriveYAGSL.java:25)
        at frc.robot.RobotContainer.<init>(RobotContainer.java:21)
        at frc.robot.Robot.<init>(Robot.java:17)
        at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:370)
        at edu.wpi.first.wpilibj.RobotBase.lambda$startRobot$1(RobotBase.java:490)
        at java.base/java.lang.Thread.run(Thread.java:840)

Error at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:383): The robot program quit unexpectedly. This is usually due to a code error.
  The above stacktrace can help determine where the error occurred.
  See https://wpilib.org/stacktrace for more information.

Error at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:389): Could not instantiate robot swervelib.encoders.SparkMaxEncoderSwerve!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions