robotpy-wpilib
robotpy-wpilib copied to clipboard
[BUG]: makeCompressor crashes
Problem description
See example code
Operating System
Windows, Linux
Installed Python Packages
No response
Reproducible example code
#!/usr/bin/env python3
from commands2 import TimedCommandRobot
from wpilib._impl.main import run
from wpilib import PneumaticHub
class Robot(TimedCommandRobot):
"""Implements a Command Based robot design"""
def robotInit(self):
"""Set up everything we need for a working robot."""
self.pneumaticsHub = PneumaticHub()
self.compressor = self.pneumaticsHub.makeCompressor()
def teleopInit(self):
pass
def autonomousInit(self):
pass
if __name__ == "__main__":
run(Robot)
This is a bug in WPILib (https://github.com/wpilibsuite/allwpilib/issues/4067).
As a workaround, you can create a compressor object directly:
self.compressor = wpilib.Compressor(0, wpilib.PneumaticsModuleType.CTREPCM)