Trying to a run a double solenoid while using the Command based template. I was able to run the double solenoid with the Timed Robot template, so the problem lies within my coding. Here’s the error:
In RobotContainer, you’re constructing four commands. In each of those, you’re constructing an entirely new ControlPanelSubsystem. The second time this happens, it crashes because you can not have two solenoids on the same ports.
You’re also doing the same with the DetectingColors class. Although it isn’t a subsystem, the same principle applies as to allocating hardware ports multiple times.
This document describes the correct process for multiple commands to have access to one instance of a subsystem. Here are some example projects showing that.
Two style nit picks:
There’s no benefit here to storing the values from Constants to the class, you can just use the values directly from Constants.
You’re also constructing a new instance of Constants everywhere you need it, which is not the recommended practice. Also, the constants should be final so they cannot be accidentally modified.