[Help] Compressor Problem (Java)

So we want our compressor to start immediately once the robot has turned on and this is a simple java code we’re experimenting with.

We’ve imported this class : Compressor compressor = new Compressor(1, 1);

And this is our current code:

public void robotInit() {
    compressor.start();

}

public void disabled() {
    compressor.stop();
}

Once I deploy this code I get an error. ([cRIO] Robot Drive… Output not updated often enough.)

In addition, I’ve confirmed that the compressor code is causing this problem because I commented out the compressor code and the cRIO accepted the code, but when I tried to deploy the code with the compressor I get that error. I’m not sure if our team’s compressor code is correct or not so please help us out.

That problem is likely not compressor related.

You’re using the RobotDrive class. If you don’t update the ouputs frequently enough you will get that error. It’s a safety feature. If your code goes off to lala land, the robot will stop itself automatically.

Do disable this feature take a look at the setSafetyEnabled method:

example:

drive.setSafetyEnabled(false)

The compressor code you posted will not cause the Robot Drive message by itself, unless it is conflicting with some of your other code. One reason might be that you are using relay 1 or DIO 1 for something else in the code also.

There is no need to disable the compressor in disabled(). In fact, with the code you posted, the compressor would never run, as it would be started in robotInit and then immediate stopped in disabled, and never re-enabled.