Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library crash on simulation #5

Open
Ramtech59Sensei opened this issue Dec 27, 2021 · 1 comment · May be fixed by #11
Open

Library crash on simulation #5

Ramtech59Sensei opened this issue Dec 27, 2021 · 1 comment · May be fixed by #11

Comments

@Ramtech59Sensei
Copy link

library crash when run in simulation mode.
trace the problem to enable voltage compensation.
I guess Rev Robotics is not doing motor controller simulation
will be nice if library can report error but not stop execution will in simulation

Error at com.swervedrivespecialties.swervelib.rev.RevUtils.checkNeoError(RevUtils.java:10):
Unhandled exception instantiating robot com.swervedrivespecialties.swervelib.rev.RevUtils
java.lang.RuntimeException: Failed to enable voltage compensation: kParamMismatchType
at com.swervedrivespecialties.swervelib.rev.RevUtils.checkNeoError(RevUtils.java:10)
at com.swervedrivespecialties.swervelib.rev.NeoDriveControllerFactoryBuilder$FactoryImplementation.create(NeoDriveControllerFactoryBuilder.java:46)
at com.swervedrivespecialties.swervelib.rev.NeoDriveControllerFactoryBuilder$FactoryImplementation.create(NeoDriveControllerFactoryBuilder.java:38)
at com.swervedrivespecialties.swervelib.DriveControllerFactory.create(DriveControllerFactory.java:19)
at com.swervedrivespecialties.swervelib.SwerveModuleFactory.create(SwerveModuleFactory.java:27)
at com.swervedrivespecialties.swervelib.Mk4SwerveModuleHelper.createNeo(Mk4SwerveModuleHelper.java:184)
at com.swervedrivespecialties.swervelib.Mk4SwerveModuleHelper.createNeo(Mk4SwerveModuleHelper.java:214)
at org.frc.subsystems.DrivetrainSubsystem.(DrivetrainSubsystem.java:105)
at org.frc.RobotContainer.(RobotContainer.java:24)
at org.frc.Robot.(Robot.java:35)
at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:289)
at edu.wpi.first.wpilibj.RobotBase.lambda$startRobot$0(RobotBase.java:387)
at java.base/java.lang.Thread.run(Thread.java:834)
Warning at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:303): Robots should not quit, but yours did!

@Ramtech59Sensei
Copy link
Author

You can solve the problem in the library if you apply this changes for CtreUtils.java and RevUtils.java

public static void checkCtreError(ErrorCode errorCode, String message) {
if (errorCode != ErrorCode.OK) {
if (RobotBase.isReal()){
throw new RuntimeException(String.format("%s: %s", message, errorCode.toString()));
}
}
}

democat3457 referenced this issue in democat3457/swerve-lib Feb 6, 2022
@democat3457 democat3457 linked a pull request Feb 6, 2022 that will close this issue
democat3457 referenced this issue in democat3457/swerve-lib Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant