Robots should not quit, but yours did!

We are trying to test our autonomous code, but the driver station keeps giving us this error:

ERROR  1  Unhandled exception instantiating robot edu.wpi.first.hal.PWMJNI edu.wpi.first.hal.util.UncleanStatusException: Code: -1029. HAL: Resource already allocated  frc.robot.commands.ShooterMoveCommand.(ShooterMoveCommand.java:17) 
Warning at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:244): Robots should not quit, but yours did!

Any solutions/suggestions?

You most likely have CAN bus numbering error(Switched CAN wires, or a wrong CAN number) / or a non-compiled vendordep file and it is not allocated into the build.gradle file

The HAL error refers to the CAN protocol

When I ran into this error a few days ago the issue is that I was calling a method on a object that was declared but not initalized:

someObject myObject;

void init()
{
     //not initializing myObject here
}

void main()
{
    myObject->DoAThing(); //causes my code to crash
}

The WPI Library keeps track of which “resources” (in this case, a PWM Channel) have already been allocated by your software. So if, say, you allocate PWM Channel 1, and then try to allocate PWM Channel 1 again, at that moment an Exception will be generated.

So it’s recommended to review the PWM channel usage in your code to find the “overlap”.

Thanks everyone, it was a problem with the auton shooter code we made. We commented it out and it worked. I have another question though: when we made the auton for the drive train, we had to require the drive subsystem. We wrote our shooter code all in robot.java, so is there no way for us to require it and create auton for it?

If you’re using the new command-based framework, you really shouldn’t have to make any changes to Robot.java. If using the old framework, you shouldn’t need much in Robot.java

Can you share your code? It would help us identify issues.

1 Like

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