We are just trying to get our tshirt cannon to do the bare minimum and open solenoids. We have been having a CAN issue for a while and we’ve tried almost everything…
Replaced all hardware
Updated PDP and PCM Firmware
Updated the PDP CAN ID to 1 and PCM CAN ID to 0
Rewired all electrical from FRC guide
I’m very sure our electrical is all correct, but we still get a CAN issue in Driver Station console.
The PDP and PCM status lights both flash slow green, even when enabled.
You might have a device in code that isn’t on your bus (like a motor controller). Make sure you have all your IDs in code correct, and also make sure you don’t have any devices in code that’s not on the bus
The code just defines PCM, I believe the library automatically gets the ID from what I’m told? It also doesn’t have a field to define it in the declaration of the PCM
No, it can, the constructor of the Solenoid and DoubleSolenoid class can take the CAN ID of the pneumatics module. I am not sure if this is your issue but we have had similar issues before and I do believe adding the CAN ID solved it.
I’m glad it worked! I have ran into this issue multiple times and always forget because it seems odd for the CAN ID to be in the solenoid rather than the pneumatics module itself, I’m sure there must be a reason for it though.
I don’t know if this still holds true but I was told at one point the reason this was done was if you were splitting a double solenoids relays onto two different PCM modules. It’s an edge case but in that scenario you want to tell it which relay and module by solenoid.
Edit. Reading the API the double doesn’t support that anymore so I’m not sure why I was told this.
If you contructed it like the following then the two objects aren’t linked together and the PCM would use CAN ID 10 and the Solenoid would use the default CAN ID 0. What PCM would the solenoid be associated with if you had multiple PCMs?
PneumaticsControlModule pcm = new PneumaticsControlModule(10);
Solenoid sol = new Solenoid(PneumaticsModuleType.CTREPCM, 0);
If you constructed it like the following, then they would associated and both would use CAN ID 11.
PneumaticsControlModule pcm2 = new PneumaticsControlModule(11);
Solenoid sol2 = pcm2.makeSolenoid(0);
The former syntax has the advantage that for robots with solenoids in multiple subsystems, you don’t need to pass PCM objects around, but with the disadvantage that you have to put in the CAN ID each time.
Code issues aside, I’m begging you, please give those CAN wires a good twisting (CAN wire should be twisted to avoid signal interference). It’s painful to look at.