Neo making humming sound after CANcoder installation

Hello,
Our team recently made the switch CAN coders from mag encoders for our neos with mk4 swerve modules. We plugged in the CANcoders into the CAN network.
The neos now start making a humming sound. This only happens after we move the wheels slightly, but then they continually hum, almost like they are trying to move the wheels to an exact position. The sparkmaxes light up to indicate they are in motion when this happens.
We suspect it may be related to PID tuning on the CAN-connected motors and encoders, but aren’t totally sure.

Here is a video of the sound - neo sound - YouTube

Can anyone provide guidance on how to diagnose and fix this issue? Thanks in advance!

I have heard this before, does the robot move just fine? Are you controlling with WPILib PID’s or closed loop PIDs?

1 Like

Hi,
Yes, it moves perfectly fine. We use a SparkMaxPIDController, which is the closed loop one.

Do the motors occasionally flip around 180 or 360 randomly? For reference my team is using the same swerve configuration with this code and it works fine.

1 Like

No,they don’t flip around at all. The code worked fine when we had mag encoders though.

1 Like

Are you constantly setting the position to slightly different angles? Maybe set them to rounded degrees?

1 Like

5549-2023/NeoSteerControllerFactoryBuilder.java at main · FRC5549Robotics/5549-2023 · GitHub here’s our code with the PID loop by the way. I’ll check on the angles and get back to you

1 Like

We will try the rounded degrees tomorrow then post an update. Thank you!

1 Like

Btw i would reccommend democats library if you can use it since you already formatted you code for it.

1 Like

Sounds like it could be a deadband issue? If the deadband is too small the PID controller will never be satisfied with the module angle and will always be working at a very low value (because your error is very small).

2 Likes

Hi Nstrike, we are using the democat swerve library, the only thing is we manually implemented the library in our code so that we could configure certain things like the current limits.

2 Likes

Hey AriMB, what do you mean by deadband issue. Would this be a deadband issue on the controller? Also where can we find the deadband issue?

1 Like

They are referring to the controller. The problem that would be caused by the lack of a deadband is a constantly adjusting value that is ever so slight it just barely adjusts the motor from it’s current state. The deadband is a minimum value from the controller which causes a action to occur only when expected. (e.g. the controller oscillates between .01 and .05 causing the angle motor to go between 330deg and 332 deg every 20ms)

1 Like

By controller are you referencing the PID controller or the Xbox Controller

1 Like

XboxController

1 Like

Ok thanks

1 Like

We tried to edit the deadband but found no luck

1 Like

I was actually referring to the deadband at the output to the PID controller. If the magnitude of the motor power is less than some value (enough to make noise but not enough to actually move it) then just ignore the output and set it to zero. If this is your problem though, it’s also safe to just ignore the noise, as stalling at such a low voltage won’t do anything other than maybe warm the motor a bit.

3 Likes

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