Compressor will not turn on

Hello guys I am having trouble with my teams robot programming. We are attempting to build an arm for this years competition and we cannot get the compressor to kick on. I can provide any info needed. The pcm status light is on and we believe all of the wiring is correct but we cant seem to get the compressor light to come on.

Have you instantiated a solenoid in the code running on the robot?

After that, try a jumper across the pressure switch terminals.

Third, look at the PCM through Phoenix Tuner to see if any errors are being thrown.

DoubleSolenoid pitchsolenoid = null;

public Thearm() {
pitchsolenoid = new DoubleSolenoid(RobotMap.THEARM_PITCH_SOLENOID_DEPLOY, RobotMap.THEARM_PITCH_SOLENOID_RETRACT);
}

public void pitchup() {
pitchsolenoid.set(Value.kForward);
}

public void pitchdown() {
pitchsolenoid.set(Value.kForward);
}

public void shiftlow(){
pitchsolenoid.set(Value.kReverse);
}

that is what i did to show a solenoid. Did i do it correctly? What is a jumper? i am about to download the phoenix tuner.

That code looks correct. Where do you create Thearm class? Somewhere else in your code it should say Thearm arm = new Thearm();.

A jumper is a piece of wire. If you temporarily connect the two sides of the pressure switch together, you can debug an issue with the pressure switch.

1 Like

As long as your constants map correctly to the channels where you plugged the Solenoid into the PCM that code should work.

Verify that your red/black wires are plugged into channel 0,1 in the PCM. Then THEARM_PITCH_SOLENOID_DEPLOY should be 0, and THEARM_PITCH_SOLENDOID_RETRACT should be 1.

If not 0,1, you need your code to match where it is physically wired.

With regard to the jumper, the jumper is closing the switch on the pressure relief valve that was done when the pnuematics documentation was followed to wire up your compressor.

The solenoid wouldn’t have anything to do with the compressor. Are you in command based? If so, create a pneumatics subsystem, with a method called whatever. In that subsystem create a new object of the compressor.
Compressor comp = new Compressor();

public synchronized void runCompressor(){
comp.start();
}

Then, create a command to run that method and set that command as the default command.

If not, in your Robot.java just create a new compressor the same way and put comp.start(); into the robotInit.

Things to Check:

  • Compressor is wired properly
  • Make sure that you have a pressure switch wired.

Nope, just create a solenoid, the compressor creation is implicit in the instantiation of any solenoid object.
No explicit compressor code is ever required.

Compressor code only gives you the option of turning off the compressor to conserve battery power on the robot.

1 Like

From the Compressor Javadoc:

So the code is correct, instantiate a DoubleSolenoid (or a Solenoid) and the compressor will automatically run in closed loop fashion.

Austin’s check of whether or not the Subsystem is being instantiated is also something that should be checked.

1 Like
public static final int THEARM_PITCH_SOLENOID_DEPLOY = 0;
  public static final int THEARM_PITCH_SOLENOID_RETRACT =1;

that is how it looks does that look ok? i had that in my code in the robotmap already.

haven’t i already made a solenoid object?

You have only instantiated the solenoid object if your Subsystem has been instantiated.

You need to verify that you have completed the step of actually creating the subsystem per Austin’s advice.

1 Like

ah i see what you mean. Where in my code should that be?

Given that you have RobotMap you are probably using the old framework.

Typically subsystems were created at the top of the Robot class in Robot.java or in the robotInit() method in Robot.java.

Wherever you instantiate the rest of your subsystems is the logical place for that to go.

 public void robotInit() {
    m_Thearm = new Thearm();
    m_oi = new OI();

that is what i have does it look right?

Hmm… That has never worked for me. I have always had to start it manually and that is how I have it today on our robot, working perfect.

so how would i go about starting it manually? is it what you showed me in your first comment?

Yes that looks right.

Mechanically if you jump the switch it should start the compressor if everything is wired correctly.

Start with Phoenix Tuner to make sure the CAN connection is correct, and go from there.

The Solenoid/DoubleSolenoid instantiation has always worked for us. We’ve never had a compressor object in our code (that I recall) and we rely on pnuematics pretty heavily every year.

1 Like

Really? This is our first year really using pneumatics for a major component of our robot and I was not able to get the compressor to turn on unless I did this.

what do you mean by jump the switch how would we go about doing that?