wpilibsuite / allwpilib

Official Repository of WPILibJ and WPILibC
https://wpilib.org/
Other
1.05k stars 612 forks source link

Compressor Closed Loop Control set to false whenever Test Mode is enabled #3245

Closed CraigFox0 closed 3 years ago

CraigFox0 commented 3 years ago

Describe the bug When test mode is enabled on the FRC dashboard, the compressor closed loop is set to false. Even if the robot is disabled and re-enabled with a different mode, it will still be set to false.

To Reproduce Steps to reproduce the behavior:

  1. Enable robot containing compressor in test mode

Expected behavior The compressor closed loop control should remain true.

Desktop (please complete the following information):

AustinShalit commented 3 years ago

Hi @CraigFox0 can you upload your robot program so we can take a closer look?

CraigFox0 commented 3 years ago

@AustinShalit we tried multiple versions of code on two different robots. We tried this repository, this repository, and a completely new blank project with only a single solenoid operated by a XboxController.

AustinShalit commented 3 years ago

Hi @CraigFox0, thank you for the code.

In the constructor of the Compressor object, we add it to the Sendable Registry:

https://github.com/wpilibsuite/allwpilib/blob/10c038d9bfabea683c67465301934ed281f3bd1c/wpilibj/src/main/java/edu/wpi/first/wpilibj/Compressor.java#L40

The implementation of the enabled flag is:

https://github.com/wpilibsuite/allwpilib/blob/10c038d9bfabea683c67465301934ed281f3bd1c/wpilibj/src/main/java/edu/wpi/first/wpilibj/Compressor.java#L207-L216

Instead of this::enabled should we be calling this::getClosedLoopControl?

CraigFox0 commented 3 years ago

That should work