Problem with Solenoids, Servos, and Digital Sensors using wpilibj2 and Trajectory Generation

Hello,
Our team is having trouble adding Solenoids, Servos, and Digital Sensors to our wpilibj2 code with Trajectory Generation. The code builds and deploys on the robot but when we try to enable the robot, the driver station gives a no robot code error and the rio log reads error: hal resources already allocated. The trajectory generation code works by itself and the solenoid code works by itself, but when combined, the error message described earlier pops up. Thank you for the help!

Here is a link to our code on Github: https://github.com/The-Charge/SulfuricAcid2020

Sounds like you are creating instances of actuators with ports that you have already instantiated. I noticed for example your shooter declares a MC on port 8 but your indexer also calls the same port number for a MC instance in there. This could be your issue, but perhaps your log gives you a specific line or file where the issue is and you can look for a similar issue there.

Hope that helps.

1 Like

Thanks for the help. We figured out what we were doing wrong. We instantiated the RobotContainer twice in Robot.java
The wpilibj2 is really new for us and we were not familiar with the relationship between Main, Robot and RobotContainer

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