I am a somewhat rookie programmer (2nd year), and I needed help with the RobotPy code for pneumatics. I have been having issues with the compressor code and how to code the double solenoid we have laid out on our robot on ports 0 and 1. Does anyone have a working example I may be able to get help from?
Thanks in advance, Noah
This might get you started:
from wpilib import Solenoid, PneumaticsModuleType
then inside an object:
self.intake_retrieve = Solenoid(PneumaticsModuleType.CTREPCM, 0)
self.intake_hold = Solenoid(PneumaticsModuleType.CTREPCM, 1)
You should be able to import the double solenoid from wpilib too. The 0 and 1 are the ports on the PCM. If you are using the pneumatics hub, just import that instead.
One note, I haven’t taken the time to figure out how to get the code to recognize the PCM on any CAN ID other than zero. It defaults to that, apparently, so with it on CAN ID 0, you only need what I show above.
Thank you for the reply, with this I think I have gotten the pneumatics on our robot to work quite well now. Thanks! Also, I ran into this while trying to fix a sticky fault for the pneumatics control module: when you have the phoenix something software installed, there should be a menu up at the top of the screen that says “CAN ID” or something of the like that will show the devices connected to the roborio through CAN. So, you find the pneumatics control module there and change the default ID to something else. Hope that helps
Thanks again
One more thing: I am going to get a screenshot or upload my code by tmr and see if you may have some things you might change about it.
Nobody wants to see a screenshot of your code, this isn’t labview.
Happy to look at it on github, as a gist, pasted here or on pastebin.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.