VictorSPX code stopped working

So over the summer my code for the last years comp robot went to fire. There was a infinite loop crash from this line here.

public static SparkMaxPIDController liftPID;

Also the Victors aren’t even being activated as the lights are indicating, here’s the code I use for all of them.

public static WPI_VictorSPX leftIntake = new WPI_VictorSPX(VictorConstants.leftIntakePort);

Thanks in advance,
Konnor from 5517.

A couple more items would be useful to help diagnose these items; What errors are being printed out to console, and can you share your project and files associated?

I’m not aware of many instances of the SparkMaxPIDController erroring out when the object is being created, so I’d be curious to look at your code and see what is going on. As for the Victors, can you flash each Victors LEDs in PhoenixTuner, and do they flash?

I haven’t tried to flash each light but in phoenix tuner they all appeared as they should since I named them all and organized them. Also for the Spark it crashed repeatedly and pointed to that line saying something along the lines of Loop Overflow. I won’t be able to get to the robot until earliest this thursday. Would you want the whole code or just some specific areas.

The whole code would be best, and if I could get the full error code when you are able to get it, that would be best, thanks!

I suggest you check the wiring first. If the LEDs on the Victors don’t seem right, a disconnected CAN wire is a likely cause. Check page 11 of the manual for the LED blink codes and see if they’re doing what you expect.

1 Like

Maybe the problem is in the wiring? We also had trouble with our roborio detecting one of our victorspx’s this weekend, When we switched to can from pwm, they did detect. Maybe it’s a general issue with them? did you try using pwm?

Here’s the error it spits out when simulating the code from what i can tell its the same with a few small additions bc of simulation suddenly shutting down as well.

at frc.robot.subsystems.Manipulator.<init>(Manipulator.java:23)
    at frc.robot.subsystems.Manipulator.<init>(Manipulator.java:23)
    at frc.robot.subsystems.Manipulator.<init>(Manipulator.java:23)

Warning at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:388): The robot program 
quit unexpectedly. This is usually due to a code error.
The above stacktrace can help determine where the error occurred.
See https://wpilib.org/stacktrace for more information.
Error at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:395): The startCompetition() 
method (or methods called by it) should have handled the exception above.
[phoenix-diagnostics] Server could NOT be disposed properly. (State:0, dur:2715|200)

[phoenix] Library could NOT shutdown cleanly

[phoenix-diagnostics] Server could NOT be disposed properly. (State:0, dur:2699|0)

Also here is the link to the code upload. Rapid React - Google Drive

I have not tried them in PWM but the can bus is definitely all good at first it wasn’t plugged into the rio but then me and my mentor fixed it and checked all the wiring.

I will have to check in person for the led codes but the wiring is all good that was one of the first things we checked. The LEDs were in there usual inactive but powered state if I remember correctly but the only color I remember was orange.

Ok so commenting off these two lines fixed the crashing, the first line was pointed to in the error and the second one was redlined because of the first one.

image
image

I might of fixed the crashing, I removed the private final manipulator line and changed m_manipulator to Manipulator and changed all forgoing mentions to static mentions and it appears to have fixed it and in simulation the talons appear to be working.

Your creating the loop by creating a new instance of Manipulator on init inside of the Manipulator definition. So what’s happening is…

  • From the RobotContainer create a new Manipulator
  • In order to create a new Manipulator, I need to create a new Manipulator
  • I try and create a new Manipulator, but I need to again create a new Manipulator
  • So on and on it goes

When in the Manipulator file, you are already working with an instance of a Manipulator, so in your commented out method of armHigh(), you can make a direct call to moveToSetpoint().

Yea that makes sense but I’m just a tad confused as how it worked all comp and just now crashes.

Check the revision history in your code version control. For example, GitHub will tell you when lines were changed and by what account.

Or you are running code that someone changed on your PC and didn’t check it into version control in which case you’ll never know who tried to “improve” the code without testing it.

There’s no access other than my local to the code. It’s backed up on GitHub but that’s it.

Bit of a late update but if I remember right it just kinda fixed itself after I reinstalled WPILib tools.

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