2024 Swerve robot stops running and connection with controller stops after 5 seconds after deploy

Hello, every time the robot (only swerve drivetrain right now) is deployed and the robot gets the code, there is just about 5 seconds when the things you do on the Xbox controller make changes to the robot. Then after that, the robot simply stops taking in input from whenever it last stopped. (If the occurrence happens when the robot is stopped, it will stay stopped, or at a specific speed, it will stay at the specific speed and encoder position) Additionally, if you enable the robot much later after the robot is deployed, it will work for one second and then have the occurrence.

Thank you for the help. We would appreciate any changes to the code you would like to suggest. This same swerve code worked last year in competition(but we added more stuff on top of it of course). We’ve been stumped the past week.

Here is our code:
https://github.com/chuck2147/CHUCK-2024

There are several changes to the Rev and CTRE libraries and that may effect your code. I didn’t do the refactor for this years library versions but sat near the person who did and they mentioned items such as the CTRE units changed everything to revolutions instead of degrees, for example. Be mindful you may have many changes to last years code to get it working correctly this year.

What other (or more specific) changes did they make to refactor the code?

Sorry I don’t have details as I was working a completely different task. This is the GitHub he is working on and I see it doesn’t include TalonFX changes yet. It’s going to be easier to look at vendors’ “what’s new” than to parse this code. 2024-Robot-Development/src/main/java/frc/robot at main · SirLanceABot/2024-Robot-Development · GitHub
I see they divided the CANcoder offsets by 360. Starting at method configCANCoder might be of use.
There’s a lot going on with this project as we are repurposing a 2022 robot for driver practice and prototype for using Neo/SparkMax replacing the original Falcon 500/TalonFX. We are trying to incorporate other best practices, too.
We try to maintain one project for multiple robots thus you see switching between robots in the Constants.java class.

  1. Turn on your safety. These are the kinds of things its there for. If you’re not giving the motor controllers new values, the safety shuts them down versus staying in that speed.

  2. What errors are you seeing in the console? If it’s working and stops, I’d imagine you have something there.

We are also having this issue (or at least a similar one), and it looks like this issue on the WPILib GitHub.

I’m getting a lot of errors about the 0.02 loop being different than expected and stale can device errors.

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