CANSparkMax motor turns on for a second and then disables the robot

Hi all! We have a CANSparkMax attatched to our wheel intake called “wheelMotor”. This motor is called by a simple whenHeld button that executes a method which just turns on the motor (.set(0.85)). However, the motor will only turn on for a couple seconds before the robot disables itself and the driver station reads no comms and no code. We ran it on the Rev client and the libraries are up to date and we reflashed the RIO as a precaution. Additionally, we put in a different CANSparkMax motor into wheelMotor’s place and it worked fine (though of course where that motor is on the robot). We are completely lost on the problem, any help is appreciated.

The relevant classes are: RobotContainer, Constants, IntakeCommand, IntakeSubsystem.
LMK if there is anything I can do to help you out!
Quick Edit: Forgot to mention that if we reenable the motor will turn on without input and disable the robot again, we need to powercycle in order to fix this.

Any errors in the logs? You can check riolog while connected from vscode, or check the logs in the driverstation.

1 Like

Right! Sorry!

The last two lines in the second image show a complete loss of communications to the roborio, but the radio is still connected. This could be caused by a few things:

  1. Roborio loses power: could turning on that motor cause the roborio to lose or interrupt power for any reason? Think wheels rubbing against wires, mechanisms shifting wire positions, etc.
  2. Roborio loses ethernet connection: Same as above, could the ethernet cable (at any point on its path between radio and rio) be disconnected?
  3. Roborio lockup: unlikely, but possible. Are you using any I2C sensors on your robot?
1 Like

We do not use I2C sensors, the connection answers seem like the most likely culprit. This motor is relatively far from our roboRIO. Thanks for the tip! I will update this post if it works (and if it doesn’t I suppose)

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