Open ErikCald opened 1 year ago
There are multiple ways to go about doing this, here is one potential way:
Other related ideas:
Options for interface: Shuffle board or web dev with Frc Web Components (https://github.com/frc-web-components/frc-web-components)
I think this works FaultID.fromId(m_driveMotor.getFaults());
This is from last year
// Add CommandScheduler to shuffleboard so we can display what commands are scheduled
ShuffleboardTab basicDebuggingTab = Shuffleboard.getTab("BasicDebugging");
basicDebuggingTab
.add("CommandScheduler", CommandScheduler.getInstance())
.withPosition(3, 0)
.withSize(3, 6);
https://docs.wpilib.org/en/stable/docs/software/dashboards/shuffleboard/layouts-with-code/index.html
Oh apparently it's a bit more complicated than asking the spark for faults. I found this code that is checking each bit in the short from getFaults()
Part of the api of CANSparkMax let's us ask it for any fault codes it is experiencing. It would awesome to periodically ask the sparks for any fault codes and log them. It would also be incredibly helpful to present any faults and which device is causing them to the pit crew. That would greatly reduce the chance of something going wrong during a match because it can be found in the pits and solved.
For example, they could see that SparkMax number 4, the arm sparkmax, is reporting a sensor fault which means the encoder is unplugged.
The best tool to display stuff to pit crew would probably be [shuffleboard], where you can store a layout of networktable values to show. (https://docs.wpilib.org/en/stable/docs/software/dashboards/shuffleboard/index.html).
This idea can also extend to other devices like the CANCoder, PCM, PDP, and probably others.