Recently, we tested our swerve modules but they were making a weird noise. We then changed the Idle Mode to coast instead of break but our modules were still making the noise. When we checked the REV Hardware Client, we found that the Smart Current Limit and Idle Mode for our CAN SPARK MAXs were automatically being changed back to 20 amps for steer motors and 80 amps for drive motors and the Idle Mode for all SPARK MAXs was being reverted to brake mode. We found that this was because the mode was being changed in a file within the rev library but we don’t know why. What is the reason for this automatic change and is it ok to put the CAN SPARK MAXs in coast mode?
Our Smart Current Limit and Idle Mode for our CAN SPARK MAX's are automatically being changed when running swerve code
Do you mind sharing your code? I haven’t heard of this issue before. I would check that your setting of variables and constants are AFTER you do any resetting to factory defaults in the code.
Here’s our code: https://github.com/FRC5549Robotics/BunnyBots_2022.
This is the path for the file that originally set the motors to brake mode. We changed this to set the motors to coast mode: BunnyBots_2022/src/main/java/frc/lib/rev/ NeoDriveControllerFactoryBuilder.java and NeoSteerControllerFactoryBuilder.java.
did you try changing the values in the rev client? I think that the rev client shows the values for those things that have been set locally instead of through code
You might like to try calling
restoreFactoryDefaults() before you make any changes to make sure that you’re not inheriting old values that you don’t intend to. You might also consider calling
burnFlash() after your changes to make your new values more persistent. (Some people claim that calling
burnFlash too often reduces the lifetime of your motor controller.)
Regarding idle mode, it’s arguably a safety concern to set coast mode on your drive motors. Consider the effect of disabling the robot when it’s going at full speed. (I discuss this at greater length here).
After looking at your code it looks like it is purposely setting the value to 20 and 80 respectively in this file:
Change these values to what you desire. I bet this was copy pasted from the SDS library without you changing it perhaps.
Were you able to solve the issue? My team ran into the same problem, you need to make a new swerve configuration you can do the following:
create a instance:
public Mk4ModuleConfiguration SwerveConfig;
set the values:
Set the modules to use that configuration: (my team is using Neos)
m_frontLeftModule = Mk4iSwerveModuleHelper.createNeo(
We found that a current limit of 20 for both the steer and drive worked.
I created a fork on your github, hope that helps!