This is our rookie year, and we are trying to code a pneumatic doube action solenoid to push the hatch panels off of our velcro grabber. We have followed several coding guides to get used to command coding, but despite long hours searching, we can’t get the compressor to turn on. The launcher subsystem code is below. The constants in the Robot_Map are 0 and 1 (the ports on the PCM that the solenoid is connected to).
public class Launcher extends Subsystem {
DoubleSolenoid launchSolenoid = null;
public void launcher(){
launchSolenoid = new DoubleSolenoid(RobotMap.SHOOTER_PITCHSOLENOID_DEPLOY, RobotMap.SHOOTER_PITCHSOLENOID_RETRACT);
}
public void launcherForward(){
launchSolenoid.set(Value.kForward);
}
public void launcherReverse(){
launchSolenoid.set(Value.kReverse);
}
We are also getting a null pointer exception when we hit the button on the joystick that uses the command that calls either the launcherForward() or launcherReverse() methods, which exits and restarts the robot code. The Phoenix Tuner also says that the PCM is not enabled, Compressor is Off and Pressure is not full.
Any help or guidance on how to finish setting up and configuring our pneumatics would be awesome. We are a Texas team, on a 2 day district event model, so we will have a chance to test solutions leading up to our first competition.
you do not need to call a command to turn on the compressor, unless you want it only to turn off and on at specific times, as long as a solenoid command is created the compressor should run. Do you happen to have a picture of your PCM wiring? is your pressure sensor installed correctly?
When we turn on the RoboRio, we get a green blinking status light. The pressure switch seems to be working on the Phoenix Tuner - it shows pressure is not full.
We tested the compressor, and when conneced to 12v source, it will turn on. GitHub link for full code is below, still unable to get the compressor to turn on when robot is enabled.
When we press the buttons to operate the solenoid, we are getting a null pointer exception in the Launcher.java subsystem (either line 28 or 32 depending which buttong is pressed) which crashes our robot code.
The phoenix tuner occasionally gives a compressor short cicuit sticky error (we have checked the wiring and there are no obvious shorts), but after we clear it, it doesn’t appear again for a while (seems random).
the wire gauge going into the pressure switch slot look pretty large for a switch, and the wires going into the compressor slot look very small for any type of COTS compressor, are you sure the wires are not switched.
Just a hunch here, but hear me out. Your Launcher subsystem class doesn’t have a constuctor, so it’s not initializing the DoubleSolenoid object, which is causing the NPE. What you have is a method named “launcher” which is never called. Check your case (“launcher” vs “Launcher”) and try again