Neo's not working well with MotorControllerGroup or System Identification tool

Our team is attempting to use PathWeaver and Trajectory for the first time. We have followed the tutorial for characterization using the System Identification tool. The problem we are facing is that our four Neo’s on the KOP chassis sound like a locomotive (say I think I can, I think I can, over and over is the rhythm it gives off) while the characterization tests are running. I was able to reproduce the same sound/issue using the MotorControllerGroup classes vs using master/follower setup in our drivetrain code.

This code runs fine, it used the master/follower pattern:
public Drivetrain() {

rightMaster = new CANSparkMax(DriveConstants.RightMasterMotorId, MotorType.kBrushless);
rightMaster.restoreFactoryDefaults();
rightMaster.setInverted(false);
rightMaster.setIdleMode(IdleMode.kBrake);
rightMaster.burnFlash();

rightFollower = new CANSparkMax(DriveConstants.rightFollowerMototId, MotorType.kBrushless);
rightFollower.restoreFactoryDefaults();
rightFollower.follow(rightMaster);
rightFollower.setInverted(false);
rightFollower.setIdleMode(IdleMode.kBrake);
rightFollower.burnFlash();

leftMaster = new CANSparkMax(DriveConstants.LeftMasterMotorId, MotorType.kBrushless);
leftMaster.restoreFactoryDefaults();
leftMaster.setInverted(true);
leftMaster.setIdleMode(IdleMode.kBrake);
leftMaster.burnFlash();

leftFollower = new CANSparkMax(DriveConstants.leftFollowerMotorId, MotorType.kBrushless);
leftFollower.restoreFactoryDefaults();
leftFollower.follow(leftMaster);
leftFollower.setInverted(true);
leftFollower.setIdleMode(IdleMode.kBrake);
leftFollower.burnFlash();

// leftMotors = new MotorControllerGroup(leftMaster, leftFollower);
// rightMotors = new MotorControllerGroup(rightMaster, rightFollower);

differentialDrive = new DifferentialDrive(leftMaster, rightMaster);
// differentialDrive = new DifferentialDrive(leftMotors, rightMotors);

}

This code uses the MotorControllerGroup class and just like the System Identification tests, the Neo’s stutter and sound like a locomotive accelerating as the tests run.

public Drivetrain() {

rightMaster = new CANSparkMax(DriveConstants.RightMasterMotorId, MotorType.kBrushless);
rightMaster.restoreFactoryDefaults();
rightMaster.setInverted(false);
rightMaster.setIdleMode(IdleMode.kBrake);
rightMaster.burnFlash();

rightFollower = new CANSparkMax(DriveConstants.rightFollowerMototId, MotorType.kBrushless);
rightFollower.restoreFactoryDefaults();
// rightFollower.follow(rightMaster);
rightFollower.setInverted(false);
rightFollower.setIdleMode(IdleMode.kBrake);
rightFollower.burnFlash();

leftMaster = new CANSparkMax(DriveConstants.LeftMasterMotorId, MotorType.kBrushless);
leftMaster.restoreFactoryDefaults();
leftMaster.setInverted(true);
leftMaster.setIdleMode(IdleMode.kBrake);
leftMaster.burnFlash();

leftFollower = new CANSparkMax(DriveConstants.leftFollowerMotorId, MotorType.kBrushless);
leftFollower.restoreFactoryDefaults();
// leftFollower.follow(leftMaster);
leftFollower.setInverted(true);
leftFollower.setIdleMode(IdleMode.kBrake);
leftFollower.burnFlash();

leftMotors = new MotorControllerGroup(leftMaster, leftFollower);
rightMotors = new MotorControllerGroup(rightMaster, rightFollower);

// differentialDrive = new DifferentialDrive(leftMaster, rightMaster);
differentialDrive = new DifferentialDrive(leftMotors, rightMotors);

}

Here is how we configured the System Identification tool for characterization tests:

We are using WPILIB 2022.3.1 version.

We don’t need to use the MotorControllerGroup classes, but we would like to use the System Identification tool and the two seem to have the same symptoms. Any ideas what we might be doing wrong, or if there is an underlying issue we are not aware of?

Thanks.

Since you are burning flash, the following behavior of the motors will persist after running your normal code. Try disabling the follower modes on the motors, and then running the characterization again. To do so, you can just replace the rightFollower.follow(rightMaster) (and so on) in your code with the below code, and run your normal project once.

rightFollower.follow(ExternalFollower.kFollowerDisabled, 0);

Thanks for the idea. I get what you are saying, that the code is leaving the motor controllers in a state that is not good for the characterization tests. I’ll give your idea a try tonight, but will say I’m doubtful. The reason I’m doubtful is that in the second set of code shown above, I first call restoreFactoryDefaults() and the follower lines of code are commented out. Using the MotorControllerGroup in that code the robot behaves exactly like it does in the characterization process, meaning it sputters along like a locomotive.

Perhaps restoreFactoryDefaults() isn’t resetting the follower modes. I can also use the Rev Hardware Client to factory reset the motor controller. It’s worth a try. Thanks for the idea.

1 Like

We had the exact same issue (sounding like a train). To resolve it we created a custom sysid logger. This can easily be adapted to your use. A lot of the stuff is hard coded, for example it only supports the drive train characterization. To use it deploy this code then use logging page in sysid to run the tests. This is obviously a temporary solution and hopefully will be fixed at the source. Hope this is helpful.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.