SwerveDriveSpecialties / Do-not-use-swerve-lib-2022-unmaintained

29 stars 76 forks source link

CTRE CANCoder startup workaround #18

Open agasser opened 2 years ago

agasser commented 2 years ago

The code in https://github.com/SwerveDriveSpecialties/swerve-lib/blob/develop/src/main/java/com/swervedrivespecialties/swervelib/ctre/Falcon500SteerControllerFactoryBuilder.java#L187 requires the swerve module state to be set in order for the workaround to be triggered.

The best case scenario is that the reset happens when the robot is on the field disabled before the match starts. You might want to rethink the location of this workaround. Under normal circumstances (especially considering https://github.com/SwerveDriveSpecialties/swerve-template/issues/11), users of the library are unlikely to be setting the state of the drivetrain when the robot is disabled.

Additionally, there is lots of good information in this CD thread. It would be a good idea to change the CANCoder initializationStrategy to BootToAbsolutePosition, since the current code changes it back to the default of BootToZero even if the user manually sets it with Phoenix Tuner.

democat3457 commented 2 years ago

The initializiationStrategy is fixed in my fork along with other fixes recommended in that thread.

Also, it seems like SDS doesn't want to update this library for whatever reason because there are a few outstanding pull requests that fix a lot of issues.