CAN Falcon 500 Drivetrain Motors Stop Intermittently

The problem

We have a mecanum drive (with 1 Falcon 500 per wheel). We are using CAN this year. Every time we run the drivetrain the motors intermittently start and stop (See this video).

If you look closely, you can see that the indicator light seems to flash orange in between red flashes, which may indicate some sort of CAN issue according to this chart from CTRE. This is supported by the fact that we are getting a “CAN frame not received / too-stale” error.

At the same time another Falcon motor that we are using for our index system seems to work fine without any stopping (you can see the index spinning smoothly at the end of the video). Also, the motors that display the stopping behavior seem to change every time we disable and re-enable the robot.

What we’ve tried

  • Visually checked the can wiring (although not

  • Checked for and removed all prints, waits and delays

  • Reversing motor controller assignments to see if is a problem with motors

  • All motor controllers seem to be plugged in and receiving signal (we haven’t actually looked too closely at the motors while we run)

  • Switching to differential drive

We’re considering just redoing all the CAN wiring to see if that fixes things, but other than that, how could we solve this problem?

Our Code

  • Here is our github: NAHSRobotics-Team5667/FRC_2021

  • Drivetrain Subsystem: NAHSRobotics-Team5667/FRC_2021/blob/main/src/main/java/frc/robot/subsystems/DriveTrainSubsystem.java

  • Drivetrain Command: NAHSRobotics-Team5667/FRC_2021/blob/main/src/main/java/frc/robot/commands/DriveTrainCommand.java

Have you experienced anything like this? Where do you think the problem might lie?

Here’s the “Our Code” section with actual links

Our Code

What sort of gearboxes are you using? Something may be jamming inside for tripping the motor breakers.

Are the PID gains correct? You might be experiencing extreme oscillations from really high P and I terms.

There might be something else that I’m missing, but that’s all I can think of after looking at your code.

1 Like

You are declaring the same TalonFX in both differential drive and mecanum drive. I suspect the motor safety in one is interfering with the other. Pick one and remove all references to the other.

4 Likes

What is the utilization of your CAN bus when this happens?

image

In general, it is often very helpful to use the log viewer to examine data from times when you have seen problems. Posting screenshots of this data can really help to answer some of these questions. In particular, “CAN %” normally shows up here. But, this data can really help to narrow the areas on which to focus for many different problems.

1 Like

I seriously doubt it has anything to do with the stuttering, but just wanted to point out that you ought to be using MecanumDriveOdometry, not DifferentialDriveOdometry.

1 Like

Make sure you aren’t assigning outputs to your motors in two places. Our programmers run into this every now and again because they will put a “Set Output” command in Teleop and Periodic for the same motor.