Unresolved Errors during runtime

Hello, we’re getting this error-
ERROR  1  Unhandled exception: edu.wpi.first.hal.util.UncleanStatusException: Code: -1029. HAL: Resource already allocated

Followed by this error-
ERROR  1  The startCompetition() method (or methods called by it) should have handled the exception above.

We are unsure how to resolve these errors and any suggestions will help, thanks.

Do you have a PCM/PDP port used multiple times in your code somewhere?

I don’t believe so but I’m confused what you mean. We don’t have pneumatic so no PCM but I don’t quite understand what you mean by PDP Port in the code. We reference the PWM ports but not the PDP

1 Like

It could also be that you’ve tried to use a single PWM/DIO port more than once in separate constructors for those objects.
ie you constructed multiple objects that use the same port.
If you post your code we can have a look and sanity check it.

1 Like

I’m more than happy to send our code but we have been having issues with out github is there any other way to send it easily? If not I can send a new repository since our issue seems to be with commits.
And we dont seem to use any PWM spots more than once

https://github.com/programming353/2020RobotProject
Try this link I’m not sure if it will work

Access to the entire codebase is ideal, through GitHub is usually the most convenient since it also shows where different files are relative to each other.
I don’t recommend paste binning or pasting it into the thread either…

404, do you have access set to private?

apparently I do. I don’t work with github alot how do I make it public

https://help.github.com/en/github/administering-a-repository/setting-repository-visibility

1 Like

Go to the repository settings, in the options tab, scroll down to the Danger Zone and click Make Public.

got it it should be public now

Interesting. My team was testing an old Victor SP earlier and got the same error and are not sure why. What device are you using over PWM?

We are using a Spark Max into Neo motor.

Here’s your problem. This will get called EVERY 20ms in teleop mode, meaning it will (try to) create MANY ExampleSubsystem objects, which will in turn try to create MANY PWMSparkMax objects. As soon as you try to create the second set, the HAL will scream because you’re trying to re-allocate the port(s).

Please take another look at the Command-Based docs: https://docs.wpilib.org/en/latest/docs/software/commandbased/index.html

3 Likes

In your command, replace
RobotContainer.m_exampleSubsystem.manualDrive(move,turn);
With
m_subsystem.manualDrive(move, turn);
If that fixes it I can explain what went wrong.

Edit: @Fletch1373 has pointed this out WITH an explanation. Sniped :stuck_out_tongue:

I tried replacing it and it gave me these error messages

ERROR  1  Unhandled exception: edu.wpi.first.hal.util.UncleanStatusException: Code: -1029. HAL: Resource already allocated

ERROR  1  The startCompetition() method (or methods called by it) should have handled the exception above.

Do you get the error with that line commented out entirely?

Yes the original line was commented out completely.

Sorry my bad, misread @Fletch1373’s post, he pinpointed the issue, those new lines need to be in robotinit and not be variables local to that method.